diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-04-19 15:05:27 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-04-19 15:05:27 -0400 |
commit | 0bf3e769e797da7bcf9b1b23a62623cc5abd6f28 (patch) | |
tree | d30179fea3e7d151b27467d96d521973d9a2bb08 /actionpack/test/controller/parameters | |
parent | 6fec9c27e5563d7c98e123c8d8eb8ef2f0c34b65 (diff) | |
parent | e539f2d5850c00ba40514af9b8f1961b0f208fe6 (diff) | |
download | rails-0bf3e769e797da7bcf9b1b23a62623cc5abd6f28.tar.gz rails-0bf3e769e797da7bcf9b1b23a62623cc5abd6f28.tar.bz2 rails-0bf3e769e797da7bcf9b1b23a62623cc5abd6f28.zip |
Merge pull request #32593 from sdhull/fix-strong-params-permit-bang
Fixes StrongParameters `permit!` to work with nested arrays
Diffstat (limited to 'actionpack/test/controller/parameters')
-rw-r--r-- | actionpack/test/controller/parameters/parameters_permit_test.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/test/controller/parameters/parameters_permit_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb index 09ac19580f..34b9ac0ab8 100644 --- a/actionpack/test/controller/parameters/parameters_permit_test.rb +++ b/actionpack/test/controller/parameters/parameters_permit_test.rb @@ -353,12 +353,15 @@ class ParametersPermitTest < ActiveSupport::TestCase assert_equal "Jonas", @params[:person][:family][:brother] end - test "permit is recursive" do + test "permit! is recursive" do + @params[:nested_array] = [[{ x: 2, y: 3 }, { x: 21, y: 42 }]] @params.permit! assert_predicate @params, :permitted? assert_predicate @params[:person], :permitted? assert_predicate @params[:person][:name], :permitted? assert_predicate @params[:person][:addresses][0], :permitted? + assert_predicate @params[:nested_array][0][0], :permitted? + assert_predicate @params[:nested_array][0][1], :permitted? end test "permitted takes a default value when Parameters.permit_all_parameters is set" do |