Rescue'ing UnknownAction

My rescue_action_in_public method catches ActiveRecord::RecordNotFound
errors perfectly find, but when I try to catch
ActionController::UnknownAction, I get the following error:


uninitialized constant UnknownAction

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dep
endencies.rb:123:in const_missing' #{RAILS_ROOT}/app/controllers/application.rb:233:inrescue_action_in_public’
/usr/local/bin/mongrel_rails:18

This error occured while loading the following files:
action_web_service/dispatcher/action_controller/unknown_action.rb

Here’s my rescue method in application.rb:

def rescue_action_in_public(e)
case e
when ActiveRecord::RecordNotFound,
ActionController::UnknownAction then
render :file => “#{RAILS_ROOT}/public/404.html”,
:status => 404
else
render :file => “#{RAILS_ROOT}/public/500.html”,
:status => 500
end
end

Any ideas why this is happening?

nobody’s rescue’d an UnknownAction error to generate a 404?

Chad wrote:

nobody’s rescue’d an UnknownAction error to generate a 404?

http://groups.google.com/group/rubyonrails-talk/search?q=UnknownAction


We develop, watch us RoR, in numbers too big to ignore.

Thanks Mark, but I read all those before and am still getting the same
uninitialized constant error.

If you know of a post that I missed, please by all means let me know.

Cheers,
Chad

Fair enough. Found it this time. It just took a day to soak it up
then I found the :: prefix.

I didn’t know a :: prefix was valid ruby code.