Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make ActionDispatch url_for use HWIA symbolize_keys

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
commit 920df0a4758d003dc284c13e439e0b9f60a6e6f0 1 parent 2472f10
@spastorino spastorino authored jeremy committed
View
2  actionpack/lib/action_dispatch/routing/url_for.rb
@@ -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
View
10 actionpack/test/controller/url_for_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.