Created
August 15, 2013 12:42
-
-
Save johanb/6240539 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
class ApplicationController < ActionController::Base | |
rescue_from ActionController::RoutingError, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: lambda { |exception| render_error 404, exception } | |
def render_error(status, exception) | |
@return_path = determine_return_path | |
@status_code = status | |
@message = I18n.t("errors.not_found") | |
respond_to do |format| | |
format.html { render template: "shared/exception", layout: 'application', status: @status_code } | |
format.all { render nothing: true, status: status } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment