lib/looksist/hashed.rb in looksist-0.1.8 vs lib/looksist/hashed.rb in looksist-0.1.9
- old
+ new
@@ -42,17 +42,17 @@
private
def inject_attributes_at(hash_offset, opts)
return hash_offset if hash_offset.nil? or hash_offset.empty?
keys = hash_offset[opts[:using]]
- entity_name = __entity__(opts[:using])
+ entity_name = __entity__(opts[:bucket_name] || opts[:using])
values = Looksist.redis_service.send("#{entity_name}_for", keys)
hash_offset[opts[:populate]] = values
hash_offset
end
def inject_attributes_for(arry_of_hashes, opts)
- entity_name = __entity__(opts[:using])
+ entity_name = __entity__(opts[:bucket_name] || opts[:using])
keys = (arry_of_hashes.collect { |i| i[opts[:using]] }).compact.uniq
values = keys.zip(Looksist.redis_service.send("#{entity_name}_for", keys)).to_h
arry_of_hashes.each do |elt|
elt[opts[:populate]] = values[elt[opts[:using]]]
end