diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-22 08:30:52 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-22 08:30:52 -0700 |
commit | 09866cef1796774654a27dcb550ad563feddc531 (patch) | |
tree | 3439ce07773c73d45adf6a9e4020ec78e4f737e1 /activerecord/test | |
parent | 5654f6870af3cfb7dd92a017e7f86ba40ebfd9bf (diff) | |
parent | 08f3f30994d37f6f44acfac801f82fc43127fc78 (diff) | |
download | rails-09866cef1796774654a27dcb550ad563feddc531.tar.gz rails-09866cef1796774654a27dcb550ad563feddc531.tar.bz2 rails-09866cef1796774654a27dcb550ad563feddc531.zip |
Merge pull request #1790 from ernie/reverse_sql_order_fix
Support reversal of ARel orderings in reverse_sql_order
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index fc9df8c7a3..aa94c9b87e 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -145,6 +145,18 @@ class RelationTest < ActiveRecord::TestCase assert_equal topics(:first).title, topics.first.title end + + def test_finding_with_arel_order + topics = Topic.order(Topic.arel_table[:id].asc) + assert_equal 4, topics.to_a.size + assert_equal topics(:first).title, topics.first.title + end + + def test_finding_last_with_arel_order + topics = Topic.order(Topic.arel_table[:id].asc) + assert_equal topics(:fourth).title, topics.last.title + end + def test_finding_with_order_concatenated topics = Topic.order('author_name').order('title') assert_equal 4, topics.to_a.size |