aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/arel/algebra/relations/operations/order.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/arel/algebra/relations/operations/order.rb b/lib/arel/algebra/relations/operations/order.rb
index df54735630..bb5ac1ab88 100644
--- a/lib/arel/algebra/relations/operations/order.rb
+++ b/lib/arel/algebra/relations/operations/order.rb
@@ -1,15 +1,21 @@
module Arel
class Order < Compound
- attributes :relation, :orderings
- deriving :==
+ attr_reader :orderings
requires :ordering
def initialize(relation, *orderings, &block)
- @relation = relation
+ super(relation)
@orderings = (orderings + arguments_from_block(relation, &block)) \
.collect { |o| o.bind(relation) }
end
+ def == other
+ super ||
+ Order === other &&
+ relation == other.relation &&
+ orderings == other.orderings
+ end
+
# TESTME
def orders
# QUESTION - do we still need relation.orders ?