Method: Bsm::Constrainable::Field::Base#merge
- Defined in:
- lib/bsm/constrainable/field/base.rb
#merge(relation, operator, value) ⇒ Object
Merge params into a relation
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bsm/constrainable/field/base.rb', line 39 def merge(relation, operator, value) operator = operator.to_sym return relation unless operators.include?(operator) operation = Bsm::Constrainable::Operation.new(operator, value, relation, self) return relation if operation.clause.nil? relation = relation.instance_eval(&scope) if scope relation.where(operation.clause) end |