module BlindIndex::Extensions::PredicateBuilder

Public Instance Methods

build(attribute, value, *args) click to toggle source

github.com/rails/rails/commit/56f30962b84fc53b76001301fb830c1594fd377e

Calls superclass method
# File lib/blind_index/extensions.rb, line 35
def build(attribute, value, *args)
  if table.has_blind_indexes? && (bi = table.send(:klass).blind_indexes[attribute.name.to_sym]) && !value.is_a?(ActiveRecord::StatementCache::Substitute)
    attribute = attribute.relation[bi[:bidx_attribute]]
    value =
      if value.is_a?(Array)
        value.map { |v| BlindIndex.generate_bidx(v, **bi) }
      else
        BlindIndex.generate_bidx(value, **bi)
      end
  end

  super(attribute, value, *args)
end