As I am in development environment, I wrote in my config/environment.rb ActionController::Base.consider_all_requests_local = false in my application.rb, I wrote def rescue_action_in_public(exception) case exception when RoutingError, UnknownAction render :file => "#{RAILS_ROOT}/public/404.html", :status => 404 else logger.error "Error raised: " + exception.to_s render :file => "#{RAILS_ROOT}/public/500.html", :status => 500 end end trying to call an url at : http://0.0.0.0:3000/cities/new (there is no new action in the controller) I got a blank page with the following message : ----- Unknown action No action responded to new ----- how can I get my rescue_action_in_public(exception) called ? thanks kad -- 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 -~----------~----~----~----~------~----~------~--~---
Kad Kerforn wrote:> As I am in development environment, I wrote in my config/environment.rb > ActionController::Base.consider_all_requests_local = false > > in my application.rb, I wrote > def rescue_action_in_public(exception) > case exception > when RoutingError, UnknownAction > render :file => "#{RAILS_ROOT}/public/404.html", :status => > 404 > else > logger.error "Error raised: " + exception.to_s > render :file => "#{RAILS_ROOT}/public/500.html", :status => > 500 > end > end > > trying to call an url at : http://0.0.0.0:3000/cities/new (there is > no new action in the controller) > I got a blank page with the following message : > ----- > Unknown action > No action responded to new > ----- > how can I get my rescue_action_in_public(exception) called ? > > thanks > > kadfor interested people I answer myself ;-)) using rescue_action_locally (exception) did it... then trapping the exception def rescue_action_locally(exception) case exception when ::ActionController::UnknownAction ... -- 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 -~----------~----~----~----~------~----~------~--~---
Seemingly Similar Threads
- rendering error page for "Unauthorized" from before_filter
- rescue_action_in_public question
- NameError (uninitialized constant UnknownAction)
- AWDWR: NameError (uninitialized constant UnknownAction) in rescue_action_in_public
- Missing action error not being caught