On Dec 15, 2005, at 5:40 PM, Hunter''s Lists wrote:
> I have an error page defined in my .htaccess file and I''m in
> production
> mode.
>
> Sometimes I still get the Application Error (Rails) white page
> though. In
> this case there was a nil object that I tried to access in a
> controller
> without first checking if it was nil.
>
> How does Rails decide what error page to display and how can I get the
> pretty error page to display more often?
>
> Thanks.
Hunter-
I think what you are looking for is called rescue_action_in_public.
You can use it like this:
In application.rb
def rescue_action_in_public(exception)
# Do something with exception. Either throw
# a 404 or send am email to your self in here.
render :text => "My pretty 404 page. exception : #{exception }"
end
And here''s a link to more: http://wiki.rubyonrails.com/rails/pages/
HowtoConfigureTheErrorPageForYourRailsApp
Cheers-
-Ezra Zygmuntowicz
WebMaster
Yakima Herald-Republic Newspaper
ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org
509-577-7732