簡體   English   中英

Rails 3 ActionView :: Template :: Error:ActionView :: Template :: Error

[英]Rails 3 ActionView::Template::Error: ActionView::Template::Error

我正在將應用程序從Rails 2.3.14升級到Rails 3.0.1

如果視圖中有任何錯誤,我總是會收到此錯誤

Development mode eh? Here is the error - #<ActionView::Template::Error: ActionView::Template::Error>
app/controllers/application_controller.rb:158:in `render_500'

這是在application_controller.rb中為render_500編寫的代碼

def render_500(error)
 if Rails.env.production?                  
   render :file => Rails.root.join('public','access_denied.html'), :status => 500
 else      
   raise Exception, I18n.t('str_error')+" - #{error.inspect}"
 end
end

我現在通過編寫puts語句來調試代碼。

請幫我解決。 提前致謝。

好了,該應用程序運行正常。 Development mode eh? Here is the error Development mode eh? Here is the errorI18n.t('str_error')內部的字符串。 您只是在引發一個異常,並且什么也不呈現,僅此字符串,因此沒有問題。
模板錯誤可能有很多原因,但更常見的是未預編譯的資產和東西。 為此進行一些研究,也許是問題所在,但請記住,所提供的代碼正在按預期工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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