lib/blind_index/extensions.rb in blind_index-1.0.1 vs lib/blind_index/extensions.rb in blind_index-1.0.2
- old
+ new
@@ -8,13 +8,13 @@
hash.each do |key, _|
if key.respond_to?(:to_sym) && (bi = klass.blind_indexes[key.to_sym]) && !new_hash[key].is_a?(ActiveRecord::StatementCache::Substitute)
value = new_hash.delete(key)
new_hash[bi[:bidx_attribute]] =
if value.is_a?(Array)
- value.map { |v| BlindIndex.generate_bidx(v, bi) }
+ value.map { |v| BlindIndex.generate_bidx(v, **bi) }
else
- BlindIndex.generate_bidx(value, bi)
+ BlindIndex.generate_bidx(value, **bi)
end
end
end
end
new_hash
@@ -62,18 +62,18 @@
module UniquenessValidator
if ActiveRecord::VERSION::STRING >= "5.2"
def build_relation(klass, attribute, value)
if klass.respond_to?(:blind_indexes) && (bi = klass.blind_indexes[attribute])
- value = BlindIndex.generate_bidx(value, bi)
+ value = BlindIndex.generate_bidx(value, **bi)
attribute = bi[:bidx_attribute]
end
super(klass, attribute, value)
end
else
def build_relation(klass, table, attribute, value)
if klass.respond_to?(:blind_indexes) && (bi = klass.blind_indexes[attribute])
- value = BlindIndex.generate_bidx(value, bi)
+ value = BlindIndex.generate_bidx(value, **bi)
attribute = bi[:bidx_attribute]
end
super(klass, table, attribute, value)
end
end