Skip to content

Instantly share code, notes, and snippets.

@johanb
Created August 15, 2013 12:42
Show Gist options
  • Save johanb/6240539 to your computer and use it in GitHub Desktop.
Save johanb/6240539 to your computer and use it in GitHub Desktop.
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