ActiveRecord :: StatementInvalid(找不到表)

时间:2014-06-24 21:55:49

标签: ruby-on-rails activerecord sqlite

我在DigitalOcean上有一个rails应用程序。我正在使用舒适的墨西哥沙发CMS。我添加了gem并运行rails generate comfy:cmsrake 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 cActiveRecord::Base.connection.tables时,表格会显示,而'comfy_cms_sites'就在那里。

1 个答案:

答案 0 :(得分:1)

确保您已使用

在生产数据库上运行迁移
rake db:migrate RAILS_ENV=production