[英]Rails ActionView::Template::Error on production
我有一个正在开发中的Rails 4应用程序,但是当我使用Capistrano部署到VPS时,出现以下错误:
INFO -- : Started GET "/" for ***.***.***.*** at 2013-12-20 22:24:28 +0000
INFO -- : Processing by PortalsController#index as HTML
INFO -- : Rendered portals/index.haml within layouts/application (2.9ms)
INFO -- : Completed 500 Internal Server Error in 7ms
FATAL -- :
ActionView::Template::Error (key not found: :params):
1: %h2
2: = link_to "New portal", new_portal_path
3:
4: %h3 Current portals:
5: = render @portals
app/views/portals/index.haml:2:in `_app_views_portals_index_haml___3074475544725108295_70221306145460'
在查看production.rb和development.rb之间的差异时,我发现该设置
config.eager_load = false
在production.rb中,错误消失了。 但是,我想将config.eager_load的默认设置保持为true。 有谁知道为什么会这样吗?
portals_controller.rb
def index
@portals = Portal.all
end
门户网站/ index.haml
%h2
= link_to "New portal", new_portal_path
%h3 Current portals:
= render @portals
门户网站/ _portal.haml
%p
= link_to portal.name, portal
配置/ routes.rb中
******::Application.routes.draw do
root to: 'portals#index'
resources :portals, shallow: true do
resources :webpages do
resources :documents
end
end
mount Resque::Server, at: "/resque"
end
我在VPS上使用了独角兽和nginx。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.