aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorRichard Schneeman <richard.schneeman@gmail.com>2016-09-07 10:46:48 -0500
committerGitHub <noreply@github.com>2016-09-07 10:46:48 -0500
commit71f37ce4893f63da49e4854db945a8ccb0ae3f5c (patch)
treea5d560b794515dbf485733eb2122214b79267972 /actionpack
parente703fc1f40c892771a0c3d81a03e7aa3561ef64a (diff)
parent700c55831f993d52dcc1eb301346fbcfd54b82d9 (diff)
downloadrails-71f37ce4893f63da49e4854db945a8ccb0ae3f5c.tar.gz
rails-71f37ce4893f63da49e4854db945a8ccb0ae3f5c.tar.bz2
rails-71f37ce4893f63da49e4854db945a8ccb0ae3f5c.zip
Merge pull request #26418 from y-yagi/fixes_26415
call `.to_h` to avoid using deprecated method
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb2
-rw-r--r--actionpack/test/controller/parameters/parameters_permit_test.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index dea4657988..387c2aa0b9 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -578,7 +578,7 @@ module ActionController
# +other_hash+ merges into current hash.
def merge(other_hash)
new_instance_with_inherited_permitted_status(
- @parameters.merge(other_hash)
+ @parameters.merge(other_hash.to_h)
)
end
diff --git a/actionpack/test/controller/parameters/parameters_permit_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb
index 164efd936c..728d8e1279 100644
--- a/actionpack/test/controller/parameters/parameters_permit_test.rb
+++ b/actionpack/test/controller/parameters/parameters_permit_test.rb
@@ -237,6 +237,13 @@ class ParametersPermitTest < ActiveSupport::TestCase
assert @params.merge(a: "b").permitted?
end
+ test "merge with parameters" do
+ other_params = ActionController::Parameters.new(id: "1234").permit!
+ merged_params = @params.merge(other_params)
+
+ assert merged_params[:id]
+ end
+
test "modifying the parameters" do
@params[:person][:hometown] = "Chicago"
@params[:person][:family] = { brother: "Jonas" }