Module: ActiveRecord::Refinements::QueryMethods

Included in:
QueryMethods
Defined in:
lib/activerecord-refinements.rb

Instance Method Summary collapse

Instance Method Details

#where(opts = nil, *rest, &block) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/activerecord-refinements.rb', line 45

def where(opts = nil, *rest, &block)
  if block
    evaluator = ActiveRecord::Refinements::WhereBlockEvaluator.new(table)
    clone.tap do |relation|
      relation.where_values += build_where(evaluator.evaluate(&block))
    end
  else
    super
  end
end