blob: 05af3fde4d125f31b3a2ae7ed406163181ec018a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
module Arel
class Order < Compound
attributes :relation, :orderings
deriving :==
def initialize(relation, *orderings, &block)
@relation = relation
@orderings = (orderings + (block_given?? [yield(relation)] : [])).collect { |o| o.bind(relation) }
end
# TESTME
def orders
(orderings + relation.orders).collect { |o| o.bind(self) }
end
end
end
|