我的 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 上。