Created
March 20, 2011 05:15
-
-
Save mnelson/878099 to your computer and use it in GitHub Desktop.
This file contains 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
require 'exception_handler' | |
class ApplicationController < ActionController::Base | |
include YourApp::ExceptionHandler | |
end |
This file contains 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
# this would live in Rails.root/lib/ or Rails.root/app/mixins/ | |
module YourApp | |
module ExceptionHandler | |
def rescue_action_in_public(exception) | |
case status_code(exception).to_s | |
when /404/ | |
render '/errors/404', :status => 404 | |
else | |
render '/errors/500', :status => 500 | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment