【发布时间】:2010-09-17 14:35:48
【问题描述】:
我的 ApplicationController 中有一个错误处理方法:
rescue_from ActiveRecord::RecordNotFound, :with => :not_found
def not_found(exception)
@exception = exception
render :template => '/errors/not_found', :status => 404
end
在RAILS_ROOT/app/views/errors/not_found.html.erb,我有这个:
<h1>Error 404: Not Found</h1>
<%= debug @exception %>
但@exception 始终是nil。我试过debug assigns,但总是{}。调用render :template 时不会复制分配吗?如果是这样,我怎样才能得到它们?
我在边缘 Rails 上。
【问题讨论】:
标签: ruby-on-rails ruby actionview