lib/mongoid/relations/referenced/many_to_many.rb in mongoid-2.3.1 vs lib/mongoid/relations/referenced/many_to_many.rb in mongoid-2.3.2

- old
+ new

@@ -28,19 +28,19 @@ batched do [].tap do |ids| args.flatten.each do |doc| next unless doc append(doc) - if persistable? || creating? + if persistable? || _creating? ids.push(doc.id) doc.save else base.send(metadata.foreign_key).push(doc.id) base.synced[metadata.foreign_key] = false end end - if persistable? || creating? + if persistable? || _creating? base.push_all(metadata.foreign_key, ids) base.synced[metadata.foreign_key] = false end end end @@ -214,18 +214,19 @@ # that will be used by this relation. # # @example Get the builder. # Referenced::ManyToMany.builder(meta, object) # + # @param [ Document ] base The base document. # @param [ Metadata ] meta The metadata of the relation. # @param [ Document, Hash ] object A document or attributes to build # with. # # @return [ Builder ] A new builder object. # # @since 2.0.0.rc.1 - def builder(meta, object, loading = false) - Builders::Referenced::ManyToMany.new(meta, object, loading) + def builder(base, meta, object) + Builders::Referenced::ManyToMany.new(base, meta, object) end # Create the standard criteria for this relation given the supplied # metadata and object. #