mardi 7 avril 2015

Rails: syntax error, unexpected tIDENTIFIER, expecting keyword_end

Ruby on Rails beginner here.


Had this error in localhost:3000


ActiveRecord::PendingMigrationError Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development


I ran rake db:migrate in terminal and got this:



$ rake db:migrate
rake aborted!
SyntaxError: /Users/EuphoriaComplex/src/bookmarks/db/migrate/20150407050503_add_user_to_bookmark.rb:5: syntax error, unexpected tIDENTIFIER, expecting keyword_end

add has_many :bookmarks to app/models/user.rb
^
/Users/EuphoriaComplex/src/bookmarks/db/migrate/20150407050503_add_user_to_bookmark.rb:7: syntax error, unexpected tIDENTIFIER, expecting keyword_end

add belongs_to :user to app/model/user.rb
^


And this is my code in bookmarks/db/migrate in Sublime:



class AddUserToBookmark < ActiveRecord::Migration
def change
add_column :bookmarks, :user_id, :integer

add has_many :bookmarks to app/models/user.rb

add belongs_to :user to app/model/user.rb
end
end


I was following this tutorial: http://ift.tt/11NgAqQ and I only made it to "Require authentication to manage your bookmarks"


"Users have many Bookmarks" is the section in question.


1 commentaire: