ApplicationController before_filters are not triggered when rendering error page within a (e.g. "application") layout when RoutingError occurs
When RoutingError (404) occurs and the error page (custom or global) should be rendered within a layout (e.g. self.error_layout = "application"), the ApplicationController before_filters are not triggered (perhaps it is not initialized at all?), which may lead to unexpected errors (missing variables etc.) and 500 is rendered instead. I understand it may be the right behaviour since there is no actual controller to be called but it could be a problem when you are trying to incorporate 404 RoutingErrors into the application layout.
When UnknownAction occurs, the before_filters are triggered and layout works fine, which makes sense.
Thank you for your response on this and thank you for this plugin!
Interesting. I am now getting back to another round of work on this gem, and will keep this in mind as I do. I haven't really considered this situation, though I'm sure I've seen it. I do know that there is no way for before_filters to get called after the error has occurred, which is why the layout used to render Routing Errors needs to be very 'protected', with lots of respond_to?(:some_method) calls to make sure nothing will break it. Because you may not have any of the expected ruby objects.
That said I will see if I can figure out why it is not rendering with a layout.