Created
April 25, 2012 15:05
-
-
Save procload/2490429 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#From Application Controller | |
unless Rails.env.development? || Rails.env.test? | |
rescue_from Exception, :with => :error_message | |
rescue_from ActiveRecord::RecordNotFound, :with => :file_not_found | |
rescue_from ActionController::RoutingError, :with => :file_not_found | |
rescue_from ActionController::UnknownController, :with => :file_not_found | |
rescue_from ActionController::UnknownAction, :with => :file_not_found | |
end | |
def error_message(e) | |
Airbrake.notify(e) | |
render :layout => 'authentication', :template => 'errors/500', :status => 500 | |
end | |
def file_not_found | |
render :layout => 'authentication', :template => 'errors/404', :status => 404 | |
end | |
#From Config Routes | |
match '*error', :to => 'application#file_not_found' unless Rails.env.development? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment