diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-04 10:12:40 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-04 10:13:22 -0800 |
commit | d22592a05b299c21e30ec8b38890a178dca863b4 (patch) | |
tree | dee6c232c25ee8d100d11aa3e3c16944200a7d99 /activerecord/test | |
parent | f8df37bc019b9537eff33d8b2a57e7b1c379640f (diff) | |
download | rails-d22592a05b299c21e30ec8b38890a178dca863b4.tar.gz rails-d22592a05b299c21e30ec8b38890a178dca863b4.tar.bz2 rails-d22592a05b299c21e30ec8b38890a178dca863b4.zip |
Merge pull request #4282 from edgecase/order_after_reorder
correctly handle order calls after a reorder
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relation_scoping_test.rb | 6 | ||||
-rw-r--r-- | activerecord/test/cases/relation_test.rb | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/test/cases/relation_scoping_test.rb b/activerecord/test/cases/relation_scoping_test.rb index c7f6ab60ef..cfcd11ca46 100644 --- a/activerecord/test/cases/relation_scoping_test.rb +++ b/activerecord/test/cases/relation_scoping_test.rb @@ -421,6 +421,12 @@ class DefaultScopingTest < ActiveRecord::TestCase assert_equal expected, received end + def test_order_after_reorder_combines_orders + expected = Developer.order('name DESC, id DESC').collect { |dev| [dev.name, dev.id] } + received = Developer.order('name ASC').reorder('name DESC').order('id DESC').collect { |dev| [dev.name, dev.id] } + assert_equal expected, received + end + def test_nested_exclusive_scope expected = Developer.find(:all, :limit => 100).collect { |dev| dev.salary } received = DeveloperOrderedBySalary.send(:with_exclusive_scope, :find => { :limit => 100 }) do diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb index 715a378431..7a75a8436b 100644 --- a/activerecord/test/cases/relation_test.rb +++ b/activerecord/test/cases/relation_test.rb @@ -20,7 +20,7 @@ module ActiveRecord end def test_single_values - assert_equal [:limit, :offset, :lock, :readonly, :from, :reorder, :reverse_order, :uniq].map(&:to_s).sort, + assert_equal [:limit, :offset, :lock, :readonly, :from, :reordering, :reverse_order, :uniq].map(&:to_s).sort, Relation::SINGLE_VALUE_METHODS.map(&:to_s).sort end |