<p>I have an error handling method in my ApplicationController:</p>

<pre><code>rescue_from ActiveRecord::RecordNotFound, :with =&gt; :not_found

def not_found(exception)
  @exception = exception
  render :template =&gt; '/errors/not_found', :status =&gt; 404
end
</code></pre>

<p>In <code>RAILS_ROOT/app/views/errors/not_found.html.erb</code>, I have this:</p>

<pre><code>&lt;h1&gt;Error 404: Not Found&lt;/h1&gt;
&lt;%= debug @exception %&gt;
</code></pre>

<p>But <code>@exception</code> is always <code>nil</code> there.  I've tried <code>debug assigns</code>, but that's always <code>{}</code>.  Do assigns not get copied when calling <code>render :template</code>?  If so, how can I get them?</p>

<p>I'm on edge Rails.</p>

That's odd, and I don't know why.  As an alternative, have you tried passing the exception as an explicit local?
```
```
def not_found(exception)
  render :template => '/errors/not_found', 
         :status   => 404, 
         :locals   => {:exception => exception}
end
```
```
and the view:
```
```
<h1>Error 404: Not Found</h1>
<%= debug exception %> <!-- Note no '@' -->
```
```