Reputation: 9222
I am starting to play around with ruby and setting up my development environment.
I am referencing This Ruby on Rails 'Getting Started Guide' and am down to section 5.5 'Running a Migration'
The problem is when I run the following command
rake db:migrate
I get the following error
C:\Users\someuser\RubymineProjects\my_app>rake db:migrate
rake aborted!
SyntaxError:C:/Users/someuser/RubymineProjects/my_app/db/migrate/20140718160751_create_articles.rb:4: syntax error, unexpected '[', expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
t.string :[title
^
C:/Users/someuser/RubymineProjects/my_app/db/migrate/20140718160751_create_articles.rb:5: syntax error, unexpected ']', expecting keyword_end
t.text] :text
^
C:in `disable_ddl_transaction'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Any idea what is causing this and how to fix it?
Upvotes: 0
Views: 442
Reputation: 24337
It looks like you have some extra brackets in your migration that don't belong there. The migration should look like:
class CreateArticles < ActiveRecord::Migration
def change
create_table :articles do |t|
t.string :title
t.text :text
t.timestamps
end
end
end
Upvotes: 3