diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2016-10-18 08:17:54 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2016-10-18 18:04:40 +0900 |
commit | 6d7f35ecb1ab6d58bb81ecbf5ff18009fb002425 (patch) | |
tree | 8e88a9cd29faa5e1595cf9ee6575614c160ab1e4 /actionpack/lib | |
parent | 8e76f6959efc44c8575b721fdf53d06ea9430fed (diff) | |
download | rails-6d7f35ecb1ab6d58bb81ecbf5ff18009fb002425.tar.gz rails-6d7f35ecb1ab6d58bb81ecbf5ff18009fb002425.tar.bz2 rails-6d7f35ecb1ab6d58bb81ecbf5ff18009fb002425.zip |
add `ActionController::Parameters#merge!`
This method has the same behavior as `Hash#merge!`, returns current
`ActionController::Parameters`.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 7 |
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 b64617d084..9df67d4be1 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. |