6

I added a new column called level to my table called ClassRequest, ran a rake db:migrate on localhost and the view worked perfectly. Pushed the changes to heroku and the view met an error "NoMethodError: undefined method `level' for #"

So I ran heroku run rake db:migrate and that appears to be successful, showing the codes below.

Running rake db:migrate attached to terminal... up, run.1
==  AddDetailsToClassRequests: migrating ======================================
-- add_column(:class_requests, :level, :string)
   -> 0.0684s
==  AddDetailsToClassRequests: migrated (0.0713s) =============================

But when I load the associated view, I still have this error "NoMethodError: undefined method `level' for #".

I'm new to rails so I don't know what's wrong, nor how do I know how to check what may have gone wrong.

Elisha
  • 63
  • 6

2 Answers2

14
heroku restart

Check the heroku's docs: https://devcenter.heroku.com/articles/rake

After running a migration you’ll want to restart your app with heroku restart to reload the schema and pickup any schema changes.

bragboy
  • 34,892
  • 30
  • 114
  • 171
luacassus
  • 6,540
  • 2
  • 40
  • 58
4

You need to restart you app after you've run the migration. Try

heroku restart

and see if things improve.

John Beynon
  • 37,398
  • 8
  • 88
  • 97