I was just thinking, how do i go about this. In the latest edition of AWDR, DHH talk about something like this.But i guess, that part of text is still not written. So any clues?
http://api.rubyonrails.com/classes/ActionController/Rescue.html#M000069
def rescue_action_in_public(exception) logger.error “Ooops: #{exception}” redirect_to home_url end
jeremy
And where should i define this method?
I have defined this method in application.rb.But it doesn’t seem to catch all errors. Or is it that, i must run in production mode to use this method?
And where should i define this method?
I have defined this method in application.rb.But it doesn’t seem to catch all errors. Or is it that, i must run in production mode to use this method?
It’s a controller instance method, so defining it in ApplicationController will affect all of your controllers, as you expect.
The method is only called when local_request? is true (dev mode), so switch to production to see the error page, or set
config.action_controller.consider_all_requests_local = false in config/environments/development.rb
jeremy