Ruby on rails Rails 3 ActionView::Template::Error:ActionView::Template::Error

Ruby on rails Rails 3 ActionView::Template::Error:ActionView::Template::Error,ruby-on-rails,Ruby On Rails,我正在将我的应用程序从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' 我现在通过编写puts语句来调试代码 请

我正在将我的应用程序从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'
我现在通过编写puts语句来调试代码


请帮我找个解决办法。提前感谢。

嗯,应用程序运行正常。
开发模式是什么?这是错误
I18n.t('str_error')中的字符串
。您只是引发了一个异常,并没有呈现任何内容,只呈现了这个字符串,所以没有问题。
模板错误可能有很多种,但更常见的是未预编译的资产和其他东西。对此做一点研究,也许这就是问题所在,但请记住,提供的代码正在按预期工作

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