Skip to content

Commit

Permalink
Actually, indifferent access mattered in the bowels (hashes hidden in…
Browse files Browse the repository at this point in the history
… arrays)

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4823 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Aug 26, 2006
1 parent a785190 commit 7b34d0f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
Expand Up @@ -207,7 +207,7 @@ def bind(key, value)
if top[-1].is_a?(Hash) && ! top[-1].key?(key) if top[-1].is_a?(Hash) && ! top[-1].key?(key)
top[-1][key] = value top[-1][key] = value
else else
top << {key => value} top << {key => value}.with_indifferent_access
push top.last push top.last
end end
else else
Expand Down
2 changes: 2 additions & 0 deletions actionpack/test/controller/cgi_test.rb
Expand Up @@ -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 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({'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 end


def test_deep_query_string_with_array_of_hashes_with_multiple_pairs def test_deep_query_string_with_array_of_hashes_with_multiple_pairs
Expand Down

0 comments on commit 7b34d0f

Please sign in to comment.