diff options
-rw-r--r-- | actionpack/lib/action_dispatch/routing/url_for.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/url_for_test.rb | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb index 394d5a6248..db17615d92 100644 --- a/actionpack/lib/action_dispatch/routing/url_for.rb +++ b/actionpack/lib/action_dispatch/routing/url_for.rb @@ -128,7 +128,7 @@ module ActionDispatch 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 diff --git a/actionpack/test/controller/url_for_test.rb b/actionpack/test/controller/url_for_test.rb index 501f928e05..907acf9573 100644 --- a/actionpack/test/controller/url_for_test.rb +++ b/actionpack/test/controller/url_for_test.rb @@ -258,13 +258,17 @@ module AbstractController 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 @@ module AbstractController end end end -end
\ No newline at end of file +end |