aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorDaniel Schierbeck <dasch@zendesk.com>2013-03-07 10:41:05 +0100
committerDaniel Schierbeck <dasch@zendesk.com>2013-03-07 10:41:05 +0100
commitd552d8fa0087d41d1e60bc77b4f50a6b57661fa3 (patch)
tree4a268298ccf1f30fce826c3fb9f76dfab0f49da6 /actionpack
parent12f785fdc7c2a9461087a887a980dffcdd236f92 (diff)
downloadrails-d552d8fa0087d41d1e60bc77b4f50a6b57661fa3.tar.gz
rails-d552d8fa0087d41d1e60bc77b4f50a6b57661fa3.tar.bz2
rails-d552d8fa0087d41d1e60bc77b4f50a6b57661fa3.zip
Use the instrumentation framework to instrument Strong Params
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/log_subscriber.rb5
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb3
2 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/log_subscriber.rb b/actionpack/lib/action_controller/log_subscriber.rb
index 3d274e7dd7..7318c8b7ec 100644
--- a/actionpack/lib/action_controller/log_subscriber.rb
+++ b/actionpack/lib/action_controller/log_subscriber.rb
@@ -48,6 +48,11 @@ module ActionController
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
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index e4dcd3213f..acad8a0799 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -339,7 +339,8 @@ module ActionController
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