lib/rom/sql/association/many_to_many.rb in rom-sql-1.2.2 vs lib/rom/sql/association/many_to_many.rb in rom-sql-1.3.0
- old
+ new
@@ -44,9 +44,21 @@
else
schema.(relation)
end
end
+ # @api private
+ def persist(relations, children, parents)
+ join_tuples = associate(relations, children, parents)
+ join_relation = join_relation(relations)
+ join_relation.multi_insert(join_tuples)
+ end
+
+ # @api private
+ def parent_combine_keys(relations)
+ relations[target].associations[source].combine_keys(relations).to_a.flatten(1)
+ end
+
# @api public
def join(relations, type, source = relations[self.source], target = relations[self.target])
through_assoc = source.associations[through]
joined = through_assoc.join(relations, type, source)
joined.__send__(type, target.name.dataset, join_keys(relations)).qualified