Created
August 27, 2018 16:39
-
-
Save pedrovanzella/b638359f0c45467f3c03786041d3bed8 to your computer and use it in GitHub Desktop.
strong params catch
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
class ApplicationController < ActionController::Base | |
#SNIP | |
rescue_from ActionController::UnpermittedParameters do |error| | |
if Rails.env.development? || Rails.env.test? | |
raise # Raise again and fail lowdly in dev and test | |
else | |
SLACK_NOTIFIER.ping("[#{Rails.env}] UNPERMITTED PARAMETERS! #{error}\nBacktrace:\n#{error.backtrace}") | |
end | |
end | |
rescue_from ActionController::ParameterMissing do |error| | |
if Rails.env.development? || Rails.env.test? | |
raise # Raise again and fail lowdly in dev and test | |
else | |
SLACK_NOTIFIER.ping("[#{Rails.env}] PARAMETERS MISSING! #{error}\nBacktrace:\n#{error.backtrace}") | |
end | |
end | |
#SNIP | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment