Method: Mongoid::Persistence::Operations::Embedded::Remove#persist
- Defined in:
- lib/mongoid/persistence/operations/embedded/remove.rb
#persist ⇒ true
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.
28 29 30 31 32 33 34 35 |
# File 'lib/mongoid/persistence/operations/embedded/remove.rb', line 28 def persist prepare do |doc| parent.remove_child(doc) if if parent.persisted? collection.update(parent.atomic_selector, deletes, ) end end end |