27 May, 2008

Handling Routing and Dispatch Errors in Rails

I've been trying to show nice error pages for RoutingErrors and MethodNotAllowed errors, which are raised outside of the context of a Controller. I dug into the routing and dispatch code and finally realized that those errors cause a direct call to :rescue_action, bypassing :rescue_action_with_handler.

I've put the result at http://pastie.caboo.se/204355.