title: rescue_from ActionController::RoutingError doesn't work
body: <p>I'm trying to rescue from <code>ActionController::RoutingError</code> and I can't get it to work. I tried almost everything that I could find online, including <a href="https://stackoverflow.com/questions/25841377/rescue-from-actioncontrollerroutingerror-in-rails4">rescue_from ActionController::RoutingError in Rails 4</a>. I have an errors controller and error pages. I got to work cancan <code>access denied</code> and <code>RecordNotFound</code>, but I can solve the <code>RoutingError</code>. </p>
  
  <p>For cancan I use this inside <code>application_controller.rb</code> </p>
  
  <pre><code>rescue_from CanCan::AccessDenied do
      render template: 'errors/error_403', status: 403
    end
  </code></pre>
  
  <p>and I have this in my routes: </p>
  
  <pre><code>match "/404", to: "errors#error_404", via: :all
  </code></pre>
  
  <p>If I do the same thing for <code>RoutingError</code> it won't work. </p>
  
  <p>I've also tried <code>match '*path', :to =&gt; "errors#error_404"</code> but I get erors. </p>
  
  <p>How can I solve this? </p>
  
  <p>Edit: If I do the same thing for <code>RoutingError</code> as for access denied:</p>
  
  <pre><code>    rescue_from ActionController::RoutingError do
         render template: 'errors/error_404', status: 404
      end
  </code></pre>
  
  <p>it won't work. </p>