Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Successful heroku run rake db:migrate but columns don't seem to work

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.

like image 878
Elisha Avatar asked Apr 25 '12 12:04

Elisha


2 Answers

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.

like image 150
luacassus Avatar answered Oct 21 '22 09:10

luacassus


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

heroku restart

and see if things improve.

like image 20
John Beynon Avatar answered Oct 21 '22 09:10

John Beynon