Browse files

Use Relation#except for reversing the order

  • Loading branch information...
1 parent 4938a57 commit 006519d2c9f142837f3b43882bcd243caa7ccdb9 @lifo lifo committed Jan 12, 2010
Showing with 2 additions and 3 deletions.
  1. +2 −3 activerecord/lib/active_record/relation/query_methods.rb
View
5 activerecord/lib/active_record/relation/query_methods.rb
@@ -41,10 +41,9 @@ def lock(locks = true)
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

0 comments on commit 006519d

Please sign in to comment.