Sha256: 41431ca783cbc58637c450924d8d8b1e939e2f21194ceee1386741f52801f20a
Contents?: true
Size: 1.16 KB
Versions: 24
Compression:
Stored size: 1.16 KB
Contents
# encoding: utf-8 module Mongoid module Persistence module Operations module Embedded # Remove is a persistence command responsible for deleting a document from # the database. # # The underlying query resembles the following MongoDB query: # # collection.remove( # { "_id" : 1 }, # false # ); class Remove include Deletion, Operations # Remove the document from the database. If the parent is a new record, # it will get removed in Ruby only. If the parent is not a new record # then either an $unset or $set will occur, depending if it's an # embeds_one or embeds_many. # # @example Remove an embedded document. # RemoveEmbedded.persist # # @return [ true ] Always true. def persist prepare do |doc| parent.remove_child(doc) if notifying_parent? if parent.persisted? collection.find(parent.atomic_selector).update(deletes) end end end end end end end end
Version data entries
24 entries across 24 versions & 2 rubygems