Method: Parse::Query#add_constraint

Defined in:
lib/parse/query.rb

#add_constraint(field, constraint) ⇒ Object

Raises:

  • (ArgumentError)


23
24
25
26
27
28
29
30
31
# File 'lib/parse/query.rb', line 23

def add_constraint(field, constraint)
  raise ArgumentError, "cannot add constraint to an $or query" if @ors.size > 0
  current = where[field]
  if current && current.is_a?(Hash) && constraint.is_a?(Hash)
    current.merge! constraint
  else
    where[field] = constraint
  end
end