aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/activerecord
diff options
context:
space:
mode:
authorRomain Tribes <tribes.romain@gmail.com>2012-08-04 10:00:33 +0200
committerRomain Tribes <tribes.romain@gmail.com>2012-08-04 10:04:05 +0200
commit61c8a4d926343903593a27080216af7e4ed81268 (patch)
tree837919b54bdb5bd78cd8a49a4b995ced1610c4c2 /actionpack/test/activerecord
parent5fe923cc341b5487fff2b7f2862829367ebd5102 (diff)
downloadrails-61c8a4d926343903593a27080216af7e4ed81268.tar.gz
rails-61c8a4d926343903593a27080216af7e4ed81268.tar.bz2
rails-61c8a4d926343903593a27080216af7e4ed81268.zip
polymorphic_url with an array generates a query string
Generating an URL with an array of records is now able to build a query string if the last item of the array is a hash.
Diffstat (limited to 'actionpack/test/activerecord')
-rw-r--r--actionpack/test/activerecord/polymorphic_routes_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/activerecord/polymorphic_routes_test.rb b/actionpack/test/activerecord/polymorphic_routes_test.rb
index afb714484b..3e6dce9590 100644
--- a/actionpack/test/activerecord/polymorphic_routes_test.rb
+++ b/actionpack/test/activerecord/polymorphic_routes_test.rb
@@ -309,6 +309,20 @@ class PolymorphicRoutesTest < ActionController::TestCase
end
end
+ def test_with_array_containing_simple_hash
+ with_test_routes do
+ @project.save
+ assert_equal "http://example.com/projects/#{@project.id}?foo=bar", polymorphic_url([@project, :foo => 'bar' ])
+ end
+ end
+
+ def test_with_array_containing_complex_hash
+ with_test_routes do
+ @project.save
+ assert_equal "http://example.com/projects/#{@project.id}?foo=bar&nested%5Bfoo%5D=bar", polymorphic_url([@project, :nested => { :foo => 'bar' }, :foo => 'bar'])
+ end
+ end
+
def test_with_array_containing_single_name
with_test_routes do
@project.save