aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/relations
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-25 17:30:22 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-25 17:30:22 -0700
commit5ad24febb4de206a5f5075259569223dcc09b6d6 (patch)
treeeaa9d29dad8a33a54de26cca640a0888c9705c69 /lib/arel/algebra/relations
parent9d07043eceab33113f55a6e8cb12f9f6ad296f5c (diff)
downloadrails-5ad24febb4de206a5f5075259569223dcc09b6d6.tar.gz
rails-5ad24febb4de206a5f5075259569223dcc09b6d6.tar.bz2
rails-5ad24febb4de206a5f5075259569223dcc09b6d6.zip
removing more meta programming
Diffstat (limited to 'lib/arel/algebra/relations')
-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 ?