aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-04-18 14:53:02 -0700
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-04-18 14:53:02 -0700
commit2a9117d8546941b90126d1548b0bbff85fca145a (patch)
treef25245493ec2724fc55b38c1be58741944a81d7f /lib
parentd51139751eae2be6ee32b44edec39fcf09ed2333 (diff)
downloadrails-2a9117d8546941b90126d1548b0bbff85fca145a.tar.gz
rails-2a9117d8546941b90126d1548b0bbff85fca145a.tar.bz2
rails-2a9117d8546941b90126d1548b0bbff85fca145a.zip
when ordering, the last order wins
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/relations/order.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/arel/relations/order.rb b/lib/arel/relations/order.rb
index 91526da02c..b1454973c8 100644
--- a/lib/arel/relations/order.rb
+++ b/lib/arel/relations/order.rb
@@ -1,21 +1,15 @@
module Arel
class Order < Compound
- attr_reader :ordering
+ attr_reader :orders
def initialize(relation, *orders)
- ordering = orders.pop
- @relation = orders.empty?? relation : Order.new(relation, *orders)
- @ordering = ordering.bind(@relation)
+ @relation, @orders = relation, orders.collect { |o| o.bind(relation) }
end
def ==(other)
self.class == other.class and
relation == other.relation and
- ordering == other.ordering
- end
-
- def orders
- relation.orders + [ordering]
+ orders == other.orders
end
end
end \ No newline at end of file