diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-06-24 13:09:33 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-06-24 13:09:33 -0700 |
commit | d6413f043ce132618c7b3d50301d66eac339f997 (patch) | |
tree | 4486b0a0584398620d2fb7c20525c10c9c8d1dc7 /activerecord/test/cases | |
parent | 7ca1a3d2aa1398ed3021f00d67e7e3fa86b600b9 (diff) | |
parent | 9734a416faaa8149fa5914b0afe2e6761ad5ec20 (diff) | |
download | rails-d6413f043ce132618c7b3d50301d66eac339f997.tar.gz rails-d6413f043ce132618c7b3d50301d66eac339f997.tar.bz2 rails-d6413f043ce132618c7b3d50301d66eac339f997.zip |
Merge pull request #1848 from raviolicode/postgresql_order_multiple_params
Fix for complex ordering of multiple columns on postgresql
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index aa94c9b87e..d88bde3860 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -176,6 +176,13 @@ class RelationTest < ActiveRecord::TestCase assert_equal entrants(:first).name, entrants.first.name end + def test_finding_with_cross_table_order_and_limit + tags = Tag.includes(:taggings) \ + .order("tags.name asc, taggings.taggable_id asc, REPLACE('abc', taggings.taggable_type, taggings.taggable_type)") \ + .limit(1).to_a + assert_equal 1, tags.length + end + def test_finding_with_complex_order_and_limit tags = Tag.includes(:taggings).order("REPLACE('abc', taggings.taggable_type, taggings.taggable_type)").limit(1).to_a assert_equal 1, tags.length |