aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorPrem Sichanugrist <prem@thoughtbot.com>2014-12-12 18:48:42 +0700
committerPrem Sichanugrist <prem@thoughtbot.com>2014-12-12 18:52:10 +0700
commit61fff0e23b80a2f867ddf7c66f9523054b2af835 (patch)
treea456e6820728b79736785386f4dc6009e1bd4be3 /actionpack/lib/action_controller
parentb5001ea4d82d5bff21510b1315ca0db2fdaa186b (diff)
downloadrails-61fff0e23b80a2f867ddf7c66f9523054b2af835.tar.gz
rails-61fff0e23b80a2f867ddf7c66f9523054b2af835.tar.bz2
rails-61fff0e23b80a2f867ddf7c66f9523054b2af835.zip
Add AC::Parameters#to_unsafe_h
As suggested in #16299([1]), this method should be a new public API for retrieving unfiltered parameters from `ActionController::Parameters` object, given that `Parameters#to_hash` will no longer work in Rails 5.0+ as we stop inheriting `Parameters` from `Hash`. [1]: https://github.com/rails/rails/pull/16299#issuecomment-50220919
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index a5ee1e2159..9a99bd2001 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -163,6 +163,12 @@ module ActionController
end
end
+ # Returns an unsafe, unfiltered +Hash+ representation of this parameter.
+ def to_unsafe_h
+ to_hash
+ end
+ alias_method :to_unsafe_hash, :to_unsafe_h
+
# Convert all hashes in values into parameters, then yield each pair like
# the same way as <tt>Hash#each_pair</tt>
def each_pair(&block)