The following exception handlers work fine. It displays a simple page
with the text "Page Not Found.". But I would like to render the
message within the application layout.
class ApplicationController < ActionController::Base
rescue_from ActionController::RoutingError, :with => :page_not_found
rescue_from ActionController::UnknownAction, :with
=> :page_not_found
protected
def page_not_found
render :text => 'Page Not Found.', :status => :not_found
end
end
Therefore when I add the layout option to the render method, as such:
class ApplicationController < ActionController::Base
rescue_from ActionController::RoutingError, :with => :page_not_found
rescue_from ActionController::UnknownAction, :with
=> :page_not_found
protected
def page_not_found
render :text => 'Page Not Found.', :layout => true, :status
=> :not_found
end
end
The response generates a "500 Internal Server Error" error. Can
anybody shed some light on why this is happening?
Thanks.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---