Skip to content
Browse files

Merge pull request #9626 from dasch/dasch/instrument-strong-params

Use AS::Notifications to instrument Strong Params
  • Loading branch information...
2 parents 9ae81be + d552d8f commit 6a18ec0a0dbac57b17d2914711bbcbba731fbc90 @josevalim josevalim committed
View
5 actionpack/lib/action_controller/log_subscriber.rb
@@ -48,6 +48,11 @@ def send_data(event)
info("Sent data #{event.payload[:filename]} (#{event.duration.round(1)}ms)")
end
+ def unpermitted_parameters(event)
+ unpermitted_keys = event.payload[:keys]
+ debug("Unpermitted parameters: #{unpermitted_keys.join(", ")}")
+ end
+
%w(write_fragment read_fragment exist_fragment?
expire_fragment expire_page write_page).each do |method|
class_eval <<-METHOD, __FILE__, __LINE__ + 1
View
3 actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -339,7 +339,8 @@ def unpermitted_parameters!(params)
if unpermitted_keys.any?
case self.class.action_on_unpermitted_parameters
when :log
- ActionController::Base.logger.debug "Unpermitted parameters: #{unpermitted_keys.join(", ")}"
+ name = "unpermitted_parameters.action_controller"
+ ActiveSupport::Notifications.instrument(name, keys: unpermitted_keys)
when :raise
raise ActionController::UnpermittedParameters.new(unpermitted_keys)
end

0 comments on commit 6a18ec0

Please sign in to comment.
Something went wrong with that request. Please try again.