Hi there,
I am trying to get my own error pages (404 for example) displayed
correctly.
I raise an error in my controller:
raise MyException.new, "Bad thing."
Therefore I defined:
class MyException < Exception
end
Furthermore I catch that in application.rb:
def rescue_action_in_public(exception)
case exception
when MyException
logger.error("404 displayed")
render :file =>
"#{RAILS_ROOT}/public/errorpages/404_myerror.html",
:status => "404", :layout => false
So far, so good. I get my page displayed. BUT everytime my application
layout (application.rhtml) gets rendered too! Look, I''ve set
":layout =>
false"!
The problem is, that I can not get a really 404 error with this. I alws
get 200 error. I think it is beacause the 404_myerror.html is rendered
within this application.rhtml. I can verify this via console:
>> app.get "/produceerror/bad"
=> 200
(in my action "bad" i raise the 404)
What do you think? This Exception handling for errors is a bit sucky ;-)
Thanks,
Rob
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---