3

I pushed an update to my Rails app production server, and in the update there was a new database migration. I ran rake db:migrate and got the common error seen here. I ran the rake again in bundle exec bash and it was successful. But after restarting my apache server, I'm now getting the 500 Error page. This update worked fine on my localhost, and was mostly this update to the db with supporting changes in the according view and controller/routing.

I don't even know why this error appeared this time, as I have pushed db updates successfully before using only rake. Nonetheless, the rake was successful. The 500 error page only shows on pages that require that specific new ActiveRecord. Any ideas on how to debug?

EDIT: My problem was an extremely simple one. I merely forgot to include the environment with the rake:

bundle exec rake db:migrate RAILS_ENV=production

Unfortunately, it took quite a while to narrow that down, as I couldn't use IRB to check the db entries until I followed these steps.

Community
  • 1
  • 1
Paul
  • 316
  • 4
  • 12

1 Answers1

6

Did you run rake db:migrate on your server? Also be sure to set the RAILS_ENV flag so your production database is updated:

rake db:migrate RAILS_ENV=production
Andrew Theis
  • 933
  • 7
  • 15