blob: 4e7133f5a87b1d21050a3530a2ce59045019e821 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
module Arel
class Order < Compound
attributes :relation, :orderings
deriving :==
def initialize(relation, *orderings, &block)
@relation = relation
@orderings = (orderings + arguments_from_block(relation, &block)) \
.collect { |o| o.bind(relation) }
end
# TESTME
def orders
# QUESTION - do we still need relation.orders ?
(orderings + relation.orders).collect { |o| o.bind(self) }.collect { |o| o.to_ordering }
end
end
end
|