lib/rom/sql/associations/many_to_many.rb in rom-sql-2.5.0 vs lib/rom/sql/associations/many_to_many.rb in rom-sql-3.0.0

- old
+ new

@@ -34,11 +34,17 @@ end # @api public def join(type, source = self.source, target = self.target) through_assoc = source.associations[through] + + # first we join source to intermediary joined = through_assoc.join(type, source) - joined.__send__(type, target.name.dataset, join_keys).qualified + + # then we join intermediary to target + target_ds = target.name.dataset + through_jk = through_assoc.target.associations[target_ds].join_keys + joined.__send__(type, target_ds, through_jk).qualified end # @api public def join_keys { source_attr => target_attr }