Last active
November 26, 2018 13:23
-
-
Save Kievbuy/30b75fee26401c0b86de8588d6c52581 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
| # Add to app/controllers/application_controller.rb | |
| if Rails.env.production? || Rails.env.staging? | |
| # https://api.rubyonrails.org/v4.2/classes/ActiveSupport/Rescuable/ClassMethods.html | |
| # https://api.rubyonrails.org/v5.2/classes/ActiveSupport/Rescuable/ClassMethods.html#method-i-rescue_from | |
| rescue_from Exception do |exception| | |
| render_error(exception, 500) | |
| end | |
| rescue_from ActionController::RoutingError, | |
| ActionController::UnknownFormat, | |
| AbstractController::ActionNotFound, | |
| ActiveRecord::RecordNotFound do |exception| | |
| render_error(exception, 404) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment