Hey,
I defined a rescue_action_in_public method per this page:
http://wiki.rubyonrails.com/rails/pages/HowtoConfigureTheErrorPageForYourRailsApp/versions/1
but am having a strange problem.
As backgroun,d my rescue method is defined only in the application
controller (i.e. it is not overridden anywhere). Code below. I also
defined a rescue_action_in_public template that prints a handy error
message and outputs the class/message of an exception when one is
thrown.
Here''s the action:
def rescue_action_in_public(exception)
logger.error("Application error " + exception.class.to_s +
": " + exception.message)
render :layout => false,
:action => ''rescue_action_in_public'',
:controller => ''application''
end
When an exception is thown and it is envoked, I see the rescue...
template is rendered, but the exception it prints out is a
TemplateError regarding a missing rescue... template (which it just
rendered). Here''s what I see in the logs:
-----
Application error ActiveRecord::StatementInvalid: <statement crap>
ActionView::TemplateError (Missing template /var/www/alpha/public/../c
onfig/../app/views//messages/rescue_action_in_public.rhtml) on line #12 of /appl
ication/index.rhtml
------
In this case, the template error refers to Application#index because a
messages action is being rendered as a component from the index (just
in case you wondered). But, what''s is strange to me is that the
template is clearly found or it could not be rendered, and
Application#rescue_action_in_public was clearly called or we sould not
see the ''Application error'' line in the log file.
Anyone know why this might occur?
Thanks an advance for your help,
pt.
--
Parker Thompson
http://www.parkert.com/
510.541.0125