aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-11-10 11:07:23 -0500
committerGitHub <noreply@github.com>2016-11-10 11:07:23 -0500
commitcd9d6bed1bc6aeee6566eed5a5162baaeba769e6 (patch)
tree6861dbb74063206990784fcc5314a3b7c2e717a8 /actionpack/lib
parentd7b333469e347824a9b2302da674d557277014d1 (diff)
parent6d7f35ecb1ab6d58bb81ecbf5ff18009fb002425 (diff)
downloadrails-cd9d6bed1bc6aeee6566eed5a5162baaeba769e6.tar.gz
rails-cd9d6bed1bc6aeee6566eed5a5162baaeba769e6.tar.bz2
rails-cd9d6bed1bc6aeee6566eed5a5162baaeba769e6.zip
Merge pull request #26820 from y-yagi/add_bang_merge_to_parameters
add `ActionController::Parameters#merge!`
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index 9c82abb640..98aacd53ab 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -573,6 +573,13 @@ module ActionController
)
end
+ # Returns current <tt>ActionController::Parameters</tt> instance which
+ # +other_hash+ merges into current hash.
+ def merge!(other_hash)
+ @parameters.merge!(other_hash.to_h)
+ self
+ end
+
# This is required by ActiveModel attribute assignment, so that user can
# pass +Parameters+ to a mass assignment methods in a model. It should not
# matter as we are using +HashWithIndifferentAccess+ internally.