On Dec 26, 9:52 pm, Ralph Shnelvar <[email protected]> wrote:
> Something is clear to you that is utterly unclear to me.
>
> What in the docs clues you in to the fact that rescue_action is better
> than rescue_from? And/or that rescue_from might not work.
> --
Interestingly enough, I generated a fresh rails 2.3.5 app, stuck
class ApplicationController < ActionController::Base
rescue_from ActionController::RoutingError, :with => :not_found
rescue_from ActionController::UnknownAction, :with => :not_found
protected
def not_found
render :text => 'Oh No!'
end
end
in application_controller.rb and the rescue_from appears to work (ie
going to /doesnotexist or /products/1/blahblah both produce oh no)
(there is a slight difference between routing error and unknown action
- the former means that rails doesn't thing the path corresponds to
anything, the latter that rails thinks it is identified the controller
& action for the request but the controller in question did not have
the appropriate action. As far as the user is concerned these are both
404s but to rails these are slightly different)
Fred
--
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.