Module: ParamsReady::Query::AbstractPredicateBuilder::HavingAttribute

Defined in:
lib/params_ready/query/predicate.rb

Instance Method Summary collapse

Instance Method Details

#associations(*arr) ⇒ Object



24
25
26
27
28
# File 'lib/params_ready/query/predicate.rb', line 24

def associations(*arr)
  arr.each do |name|
    @definition.add_association name
  end
end

#attribute(name: nil, expression: nil, &block) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/params_ready/query/predicate.rb', line 30

def attribute(name: nil, expression: nil, &block)
  expression = if expression
    raise ParamsReadyError, 'Block unexpected' unless block.nil?
    expression
  else
    raise ParamsReadyError, 'Expression unexpected' unless expression.nil?
    block
  end
  @definition.set_attribute(name, expression)
end