aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2013-09-22 23:57:21 +0900
committerkennyj <kennyj@gmail.com>2013-09-27 03:53:45 +0900
commit277918e61afaec64c1378194ea272f938beaa8ad (patch)
tree5891cf80bc812825e0bcfa06b43a48d2c5da60b2 /actionpack/test
parent3f488d4a076ba0146535ef6e2aa9cb21a1882810 (diff)
downloadrails-277918e61afaec64c1378194ea272f938beaa8ad.tar.gz
rails-277918e61afaec64c1378194ea272f938beaa8ad.tar.bz2
rails-277918e61afaec64c1378194ea272f938beaa8ad.zip
Strong parameters should permit nested number as key. Closes #12293
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/parameters/nested_parameters_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/test/controller/parameters/nested_parameters_test.rb b/actionpack/test/controller/parameters/nested_parameters_test.rb
index 91df527dec..3b1257e8d5 100644
--- a/actionpack/test/controller/parameters/nested_parameters_test.rb
+++ b/actionpack/test/controller/parameters/nested_parameters_test.rb
@@ -169,4 +169,19 @@ class NestedParametersTest < ActiveSupport::TestCase
assert_filtered_out permitted[:book][:authors_attributes]['-1'], :age_of_death
end
+
+ test "nested number as key" do
+ params = ActionController::Parameters.new({
+ product: {
+ properties: {
+ '0' => "prop0",
+ '1' => "prop1"
+ }
+ }
+ })
+ params = params.require(:product).permit(:properties => ["0"])
+ assert_not_nil params[:properties]["0"]
+ assert_nil params[:properties]["1"]
+ assert_equal "prop0", params[:properties]["0"]
+ end
end