Make ActionDispatch url_for use HWIA symbolize_keys
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
This commit is contained in:
parent
2472f1026a
commit
920df0a475
@ -128,7 +128,7 @@ def url_for(options = nil)
|
||||
when String
|
||||
options
|
||||
when nil, Hash
|
||||
_router.url_for(url_options.merge(options || {}).symbolize_keys)
|
||||
_router.url_for(url_options.merge((options || {}).symbolize_keys))
|
||||
else
|
||||
polymorphic_url(options)
|
||||
end
|
||||
|
@ -258,13 +258,17 @@ def test_multiple_includes_maintain_distinct_options
|
||||
end
|
||||
|
||||
def test_with_stringified_keys
|
||||
assert_equal("/c/a", W.new.url_for('controller' => 'c', 'action' => 'a', 'only_path' => true))
|
||||
assert_equal("/c", W.new.url_for('controller' => 'c', 'only_path' => true))
|
||||
assert_equal("/c/a", W.new.url_for('controller' => 'c', 'action' => 'a', 'only_path' => true))
|
||||
end
|
||||
|
||||
def test_with_hash_with_indifferent_access
|
||||
assert_equal("/c/a", W.new.url_for(HashWithIndifferentAccess.new('controller' => 'c', 'action' => 'a', 'only_path' => true)))
|
||||
W.default_url_options[:controller] = 'd'
|
||||
W.default_url_options[:only_path] = false
|
||||
assert_equal("/c", W.new.url_for(HashWithIndifferentAccess.new('controller' => 'c', 'only_path' => true)))
|
||||
|
||||
W.default_url_options[:action] = 'b'
|
||||
assert_equal("/c/a", W.new.url_for(HashWithIndifferentAccess.new('controller' => 'c', 'action' => 'a', 'only_path' => true)))
|
||||
end
|
||||
|
||||
private
|
||||
@ -273,4 +277,4 @@ def extract_params(url)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user