blob: 9d868ac18b0941d4207c60c008d73a23bf886fb3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
module Arel
class Where < Compound
attributes :relation, :predicates
deriving :==
requires :restricting
def initialize(relation, *predicates)
predicates = [yield(relation)] + predicates if block_given?
@predicates = predicates.map { |p| p.bind(relation) }
@relation = relation
end
def wheres
@wheres ||= relation.wheres + predicates
end
end
end
|