lib/rom/plugins/relation/sql/auto_combine.rb in rom-sql-1.0.0.rc1 vs lib/rom/plugins/relation/sql/auto_combine.rb in rom-sql-1.0.0.rc2
- old
+ new
@@ -44,10 +44,13 @@
target.preload(source_key, target_key)
end
# @api private
def preload(source_key, target_key, source)
- where(target_key => source.pluck(source_key.to_sym))
+ target_pks = source.pluck(source_key.to_sym).uniq
+ target_pks.uniq!
+
+ where(target_key => target_pks)
end
end
end
end
end