aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/activerecord/polymorphic_routes_test.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2012-08-04 11:24:53 +0100
committerAndrew White <andyw@pixeltrix.co.uk>2012-08-04 11:24:53 +0100
commit6be564c7a087773cb0b51c54396cc190e4f5c983 (patch)
tree1b3474650e529d52d5051fac256ee7fea736588c /actionpack/test/activerecord/polymorphic_routes_test.rb
parent61c8a4d926343903593a27080216af7e4ed81268 (diff)
downloadrails-6be564c7a087773cb0b51c54396cc190e4f5c983.tar.gz
rails-6be564c7a087773cb0b51c54396cc190e4f5c983.tar.bz2
rails-6be564c7a087773cb0b51c54396cc190e4f5c983.zip
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
Diffstat (limited to 'actionpack/test/activerecord/polymorphic_routes_test.rb')
-rw-r--r--actionpack/test/activerecord/polymorphic_routes_test.rb7
1 files changed, 7 insertions, 0 deletions
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