Class: MongoMapper::Plugins::Associations::ManyDocumentsProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/mm-nested-attributes.rb

Instance Method Summary collapse

Instance Method Details

#save_to_collection_with_delete(options = {}) ⇒ Object Also known as: save_to_collection



23
24
25
26
27
28
29
# File 'lib/mm-nested-attributes.rb', line 23

def save_to_collection_with_delete(options={})
  if @target
    to_delete = @target.delete_if { |doc| doc.marked_for_destruction? }
    to_delete.each { |doc| doc.destroy }
  end
  save_to_collection_without_delete(options)
end