14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/ransack/configuration.rb', line 14
def add_predicate(name, opts = {})
name = name.to_s
opts[:name] = name
compounds = opts.delete(:compounds)
compounds = true if compounds.nil?
opts[:arel_predicate] = opts[:arel_predicate].to_s
self.predicates[name] = Predicate.new(opts)
['_any', '_all'].each do |suffix|
self.predicates[name + suffix] = Predicate.new(
opts.merge(
:name => name + suffix,
:arel_predicate => opts[:arel_predicate] + suffix,
:compound => true
)
)
end if compounds
end
|