This project is archived and is in readonly mode.

#6462 ✓resolved
Prem Sichanugrist (sikachu)

Make sure Rails will always raise `ActionController::RoutingError` when show_exceptions is set to false

Reported by Prem Sichanugrist (sikachu) | February 22nd, 2011 @ 08:16 PM | in 3.x

Refer to this StackOverflow question:

I just found that there's a bug in Rails since April 2010 that if you set the config.action_dispatch.show_exceptions to false you wouldn't get ActionController::RoutingError because the middleware that supposed to raise the exception, ActionDispatch::ShowExceptions doesn't get loaded if the config.action_dispatch.show_exceptions is set to false.

This patch will make sure that the middleware will always get loaded. So if the middleware down the stack returns a "X-Cascade: pass" header, it will raise the ActionController::RoutingError as expected.

I've separate the patches into three commits:

  1. Make sure that we set env["action_dispatch.show_exceptions"]
  2. Add failing test case for application not raising ActionController::RoutingError even the route is not found.
  3. Always use ActionDispatch::ShowExceptions middleware

I would love to see this got committed in both master and 3-0-stable as there's already someone on 3.0.x came across this bug while doing test driven development.

Thank you.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

Referenced by