Skip to content

Instantly share code, notes, and snippets.

@mnelson
Created March 20, 2011 05:15
Show Gist options
  • Save mnelson/878099 to your computer and use it in GitHub Desktop.
Save mnelson/878099 to your computer and use it in GitHub Desktop.
require 'exception_handler'
class ApplicationController < ActionController::Base
include YourApp::ExceptionHandler
end
# 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