【问题标题】:ActiveRecord::StatementInvalid (Could not find table)ActiveRecord::StatementInvalid(找不到表)
【发布时间】:2014-06-24 21:55:49
【问题描述】:

我在 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' 就在那里。

【问题讨论】:

    标签: ruby-on-rails rails-activerecord rails-migrations


    【解决方案1】:

    确保您已在生产数据库上运行迁移

    rake db:migrate RAILS_ENV=production
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-13
      • 1970-01-01
      • 2019-12-12
      • 1970-01-01
      • 1970-01-01
      • 2014-07-10
      • 1970-01-01
      • 2013-10-31
      相关资源
      最近更新 更多