This project is archived and is in readonly mode.
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: http://stackoverflow.com/questions/5022454/raising-route-not-found-...
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:
- Make sure that we set
env["action_dispatch.show_exceptions"]
- Add failing test case for application not raising
ActionController::RoutingError even the route is not
found.
- 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
-
Prem Sichanugrist (sikachu) February 24th, 2011 @ 05:22 PM
- Assigned user changed from José Valim to Aaron Patterson
I've updated the patch and rebase 002+003 together, per Aaron request
-
Aaron Patterson February 24th, 2011 @ 07:49 PM
Prem, can you also backport these to 3.0 for me? Sorry, I'm feeling lazy. ;-)
-
Prem Sichanugrist (sikachu) February 25th, 2011 @ 10:00 AM
Here's your patch for 3-0-stable, Aaron ;)
-
Aaron Patterson February 25th, 2011 @ 06:45 PM
- State changed from open to committed
applied and pushed, thanks!
-
Repository February 25th, 2011 @ 06:46 PM
- State changed from committed to resolved
(from [2a67e69f1ff8960c4b4190c3189e2ab7250b4faf]) Always use ActionDispatch::ShowExceptions middleware [#6462 state:resolved]
This will make sure the application will raise
ActionController::RoutingError
in case "X-Cascade: pass" header was set, usually when there's no route match.(This is a backported version to 3-0-stable) https://github.com/rails/rails/commit/2a67e69f1ff8960c4b4190c3189e2...
-
Repository February 25th, 2011 @ 06:46 PM
(from [515ea955b6a80ab9f527ad0f6dcc25a17688a02c]) Always use ActionDispatch::ShowExceptions middleware [#6462 state:resolved]
This will make sure the application will raise
ActionController::RoutingError
in case "X-Cascade: pass" header was set, usually when there's no route match.
https://github.com/rails/rails/commit/515ea955b6a80ab9f527ad0f6dcc2...
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 6462 Make sure Rails will always raise `ActionController::RoutingError` when show_exceptions is set to false (from [2a67e69f1ff8960c4b4190c3189e2ab7250b4faf]) Always ...
- 6462 Make sure Rails will always raise `ActionController::RoutingError` when show_exceptions is set to false (from [515ea955b6a80ab9f527ad0f6dcc25a17688a02c]) Always ...