A successful hero launches rake db: migrate, but the columns do not seem to work

I added a new column called level to my table called ClassRequest, ran rake db: migrate on localhost, and the view worked fine. Pushed changes to the hero, and the error "NoMethodError: undefined method` level" for # "occurred in the view

So, I ran heroku run rake db: migrate and it seems 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 am new to rails, so I don’t know what is wrong, and how I know how to check what went wrong.

+6
source share
2 answers
 heroku restart 

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

After starting the migration, you want to restart the application using the hero restart to restart the scheme and select any changes to the scheme.

+12
source

You need to restart the application after starting the migration. Try

heroku restart

and see if things improve.

+4
source

Source: https://habr.com/ru/post/914126/


All Articles