diff --git a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb index 5f4f8d80d56dc3c0fd869cf8df289440cb38a448..26adbca13c91c43fdb9f3122537db5d29a6680f8 100755 --- a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb +++ b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb @@ -207,7 +207,7 @@ def bind(key, value) if top[-1].is_a?(Hash) && ! top[-1].key?(key) top[-1][key] = value else - top << {key => value} + top << {key => value}.with_indifferent_access push top.last end else diff --git a/actionpack/test/controller/cgi_test.rb b/actionpack/test/controller/cgi_test.rb index ee2892f618fd081819ccc12301db5784b8756169..d235379e3d05eaeaeea8e3f26a796e06568d3b2d 100755 --- a/actionpack/test/controller/cgi_test.rb +++ b/actionpack/test/controller/cgi_test.rb @@ -43,6 +43,8 @@ def test_deep_query_string_with_array_of_hash def test_deep_query_string_with_array_of_hashes_with_one_pair assert_equal({'x' => {'y' => [{'z' => '10'}, {'z' => '20'}]}}, CGIMethods.parse_query_parameters('x[y][][z]=10&x[y][][z]=20')) + assert_equal("10", CGIMethods.parse_query_parameters('x[y][][z]=10&x[y][][z]=20')["x"]["y"].first["z"]) + assert_equal("10", CGIMethods.parse_query_parameters('x[y][][z]=10&x[y][][z]=20').with_indifferent_access[:x][:y].first[:z]) end def test_deep_query_string_with_array_of_hashes_with_multiple_pairs