Heroku Error: ActionView::Template::Error (undefined method `advice' for nil:NilClass):

Hi Guys,

My rails app is running perfectly in development (local machine), but when I push it to Heroku I get the following error message:

ActionView::Template::Error (undefined method `advice’ for nil:NilClass):

I ran the following to make sure I’m not missing a migration on heroku:
heroku run rake db:reset
heroku run rake db:migrate
heroku restart

I’m running postgres on production and development.

Many thanks for helping!


Will need a little more info, preferably code to help debug

Hey Eric,

Thanks for your reply. That was rather stupid of me to not add a link to my github repo.

Either way, a friend helped me fix everything last night. The problem was that my db on Heroku did not contain a single value and therefore threw an error when it came to the first method.

We fixed it by creating a new object as the very first thing in the index action.

You can see the code in the github repo here: https://github.com/MarcoMorawec/drawtheowl


Lesson learn is to check for nil values more often