Actually, indifferent access mattered in the bowels (hashes hidden in arrays)

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4823 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 a7851907
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册