diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2013-03-09 12:35:23 -0800 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2013-03-09 12:35:23 -0800 |
commit | 6a18ec0a0dbac57b17d2914711bbcbba731fbc90 (patch) | |
tree | b0a1a42233a30d0bd72300879d6c6fa643f4cfcd /actionpack/lib/action_controller | |
parent | 9ae81be072ef392cadd291c92889e7ca7c878f32 (diff) | |
parent | d552d8fa0087d41d1e60bc77b4f50a6b57661fa3 (diff) | |
download | rails-6a18ec0a0dbac57b17d2914711bbcbba731fbc90.tar.gz rails-6a18ec0a0dbac57b17d2914711bbcbba731fbc90.tar.bz2 rails-6a18ec0a0dbac57b17d2914711bbcbba731fbc90.zip |
Merge pull request #9626 from dasch/dasch/instrument-strong-params
Use AS::Notifications to instrument Strong Params
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/log_subscriber.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 3 |
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 |