15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/blind_index/extensions.rb', line 15
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) || (defined?(Set) && value.is_a?(Set))
value.map { |v| BlindIndex.generate_bidx(v, **bi) }
else
BlindIndex.generate_bidx(value, **bi)
end
end
super(attribute, value, *args)
end
|