我在 DigitalOcean 上有一个 Rails 应用程序。我正在使用舒适的墨西哥沙发 CMS。我添加了 gem 并运行 railsgenerate comfy:cms
和 rake db:migrate
但当我导航到 example.com/admin 时,我收到 500 错误,并且我的应用程序无法找到必要的表格。这是我在日志中收到的错误。
I, [2014-06-24T21:51:18.397255 #18789] INFO -- : Started GET "/" for 173.10.20.190 at 2014-06-24 21:51:18 +0000
I, [2014-06-24T21:51:18.425183 #18789] INFO -- : Processing by HomeController#index as HTML
I, [2014-06-24T21:51:18.442366 #18789] INFO -- : Rendered home/index.html.erb within layouts/application (1.2ms)
I, [2014-06-24T21:51:18.445116 #18789] INFO -- : Completed 200 OK in 20ms (Views: 9.5ms | ActiveRecord: 0.0ms)
I, [2014-06-24T21:51:18.599085 #18786] INFO -- : Started GET "/assets/rails.png" for 173.10.20.190 at 2014-06-24 21:51:18 +0000
I, [2014-06-24T21:51:23.516755 #18789] INFO -- : Started GET "/admin" for 173.10.20.190 at 2014-06-24 21:51:23 +0000
I, [2014-06-24T21:51:23.522184 #18789] INFO -- : Processing by Comfy::Admin::Cms::BaseController#jump as HTML
I, [2014-06-24T21:51:23.526053 #18789] INFO -- : Completed 500 Internal Server Error in 4ms
F, [2014-06-24T21:51:23.532357 #18789] FATAL -- :
ActiveRecord::StatementInvalid (Could not find table 'comfy_cms_sites'):
对我来说奇怪的是,当我运行 rails c
和 ActiveRecord::Base.connection.tables
时,表格会显示,并且“comfy_cms_sites”就在那里。
最佳答案
确保您已在生产数据库上运行迁移
rake db:migrate RAILS_ENV=production
关于ruby-on-rails - ActiveRecord::StatementInvalid(找不到表),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24396997/