Reputation: 159
Hello and thank you in advance for your time racing this,
I am new to RoR and i´m following RUBY ON RAILS TUTORIAL by Michael Hartl, I got really stuck with this error when im trying to migrate the db in heroku (i know that what syntax error means (END) but i still can't solve it)
heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.4787
Migrating to CreateUsers (20141001220747)
rake aborted!
SyntaxError: /app/db/migrate/20141001220747_create_users.rb:10: syntax error, unexpected keyword_end, expecting end-of-input
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `block in require'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:214:in `load_dependency'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:722:in `load_migration'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:718:in `migration'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:712:in `disable_ddl_transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:1016:in `use_transaction?'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:1008:in `ddl_transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:962:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:924:in `block in migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:920:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:920:in `migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:768:in `up'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:746:in `migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
i have done my research and figured out that the problem is with an extra or missing END, but i have tried adding and deleting ends... with no luck. The weird thing is that the error is exactly the same even if I add or delete ENDS. Here is the file for the migration
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.string :email
t.timestamps
end
end
end
Thanks a lot and hope you can help. Happy coding
Upvotes: 0
Views: 66
Reputation: 159
Found the problem. The issue was that i was doing the changes locally and was missing to commit the changes, push them to git and then pull them in the heroku instance.
Once I did it I could run the db migration with no issues.
BTW the code I posted on top was the correct one but the first time i pushed it, it had a syntax error defining the class.
Upvotes: 1