I have an error handling method in my ApplicationController:
rescue_from ActiveRecord::RecordNotFound, :with => :not_found def not_found(exception) @exception = exception render :template => '/errors/not_found', :status => 404 end
In RAILS_ROOT/app/views/errors/not_found.html.erb, I have this:
<h1>Error 404: Not Found</h1> <%= debug @exception %>
But @exception is always nil there. I’ve tried debug assigns, but that’s always {}. Do assigns not get copied when calling render :template? If so, how can I get them?
I’m on edge Rails.
That’s odd, and I don’t know why. As an alternative, have you tried passing the exception as an explicit local?
and the view: