lib/blind_index/extensions.rb in blind_index-0.3.2 vs lib/blind_index/extensions.rb in blind_index-0.3.3
- old
+ new
@@ -4,11 +4,11 @@
module TableMetadata
def resolve_column_aliases(hash)
new_hash = super
if has_blind_indexes?
hash.each do |key, _|
- if (bi = klass.blind_indexes[key]) && !new_hash[key].is_a?(ActiveRecord::StatementCache::Substitute)
+ if key.respond_to?(:to_sym) && (bi = klass.blind_indexes[key.to_sym]) && !new_hash[key].is_a?(ActiveRecord::StatementCache::Substitute)
new_hash[bi[:bidx_attribute]] = BlindIndex.generate_bidx(new_hash.delete(key), bi)
end
end
end
new_hash
@@ -27,10 +27,10 @@
module PredicateBuilder
def resolve_column_aliases(klass, hash)
new_hash = super
if has_blind_indexes?(klass)
hash.each do |key, _|
- if (bi = klass.blind_indexes[key]) && !new_hash[key].is_a?(ActiveRecord::StatementCache::Substitute)
+ if key.respond_to?(:to_sym) && (bi = klass.blind_indexes[key.to_sym]) && !new_hash[key].is_a?(ActiveRecord::StatementCache::Substitute)
new_hash[bi[:bidx_attribute]] = BlindIndex.generate_bidx(new_hash.delete(key), bi)
end
end
end
new_hash