Skip to content

Instantly share code, notes, and snippets.

@pedrovanzella
Created August 27, 2018 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedrovanzella/b638359f0c45467f3c03786041d3bed8 to your computer and use it in GitHub Desktop.
Save pedrovanzella/b638359f0c45467f3c03786041d3bed8 to your computer and use it in GitHub Desktop.
strong params catch
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