mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #26418 from y-yagi/fixes_26415
call `.to_h` to avoid using deprecated method
This commit is contained in:
commit
71f37ce489
2 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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" }
|
||||
|
|
Loading…
Reference in a new issue