我向 Rails 应用程序生产服务器推送了更新,更新中包含新的数据库迁移。我运行了 rake db:migrate 并看到了常见错误 此处。我在 bundle exec bash
中再次运行了 rake,并且成功了。但重新启动我的 apache 服务器后,我现在收到 500 错误页面。此更新在我的本地主机上运行良好,主要是对数据库的更新,支持相应视图和控制器/路由中的更改。
我什至不知道为什么这次会出现这个错误,因为我在仅使用rake
之前已经成功推送了数据库更新。尽管如此,耙子还是成功了。 500 错误页面仅显示在需要特定新 ActiveRecord 的页面上。关于如何调试有什么想法吗?
编辑:我的问题非常简单。我只是忘记将环境包含在 rake 中:
bundle exec rake db:migrate RAILS_ENV=production
不幸的是,我花了相当长的时间来缩小范围,因为我无法使用 IRB 来检查数据库条目,直到我按照这些 步骤。
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.
发布评论
评论(1)
您是否在服务器上运行了 rake db:migrate ?还要确保设置 RAILS_ENV 标志,以便更新您的生产数据库:
Did you run rake db:migrate on your server? Also be sure to set the RAILS_ENV flag so your production database is updated: