From 6be564c7a087773cb0b51c54396cc190e4f5c983 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sat, 4 Aug 2012 11:24:53 +0100 Subject: Refactor passing url options via array for polymorphic_url Rather than keep the url options in record_or_hash_or_array, extract it and reverse merge with options as it may contain important private keys like `:routing_type`. Closes #7259 --- actionpack/test/activerecord/polymorphic_routes_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actionpack/test/activerecord/polymorphic_routes_test.rb') diff --git a/actionpack/test/activerecord/polymorphic_routes_test.rb b/actionpack/test/activerecord/polymorphic_routes_test.rb index 3e6dce9590..9454a6d726 100644 --- a/actionpack/test/activerecord/polymorphic_routes_test.rb +++ b/actionpack/test/activerecord/polymorphic_routes_test.rb @@ -323,6 +323,13 @@ class PolymorphicRoutesTest < ActionController::TestCase end end + def test_with_array_containing_simple_hash_options_take_precedence + with_test_routes do + @project.save + assert_equal "http://example.com/projects/#{@project.id}?foo=baz", polymorphic_url([@project, :foo => 'bar' ], :foo => 'baz') + end + end + def test_with_array_containing_single_name with_test_routes do @project.save -- cgit v1.2.3