簡體   English   中英

Rails ActionView :: Template ::生產錯誤

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM