diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-12 22:55:57 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-12 22:55:57 +0530 |
commit | 006519d2c9f142837f3b43882bcd243caa7ccdb9 (patch) | |
tree | e6b69f4a787a0db364b993f20e9dcf476c73b6bc | |
parent | 4938a5746ddd3527c119d946e638505d32a6416f (diff) | |
download | rails-006519d2c9f142837f3b43882bcd243caa7ccdb9.tar.gz rails-006519d2c9f142837f3b43882bcd243caa7ccdb9.tar.bz2 rails-006519d2c9f142837f3b43882bcd243caa7ccdb9.zip |
Use Relation#except for reversing the order
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index c07eca44e3..7ceec40954 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -41,10 +41,9 @@ module ActiveRecord end def reverse_order - relation = spawn - relation.instance_variable_set(:@orders, nil) - order_clause = arel.send(:order_clauses).join(', ') + relation = except(:order) + if order_clause.present? relation.order(reverse_sql_order(order_clause)) else |