Skip to content

Instantly share code, notes, and snippets.

@procload
Created April 25, 2012 15:05
Show Gist options
  • Save procload/2490429 to your computer and use it in GitHub Desktop.
Save procload/2490429 to your computer and use it in GitHub Desktop.
#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