Method: MongoMapper::Plugins::Associations::ManyDocumentsProxy#replace

Defined in:
lib/mongo_mapper/plugins/associations/many_documents_proxy.rb

#replace(docs) ⇒ Object



37
38
39
40
41
42
# File 'lib/mongo_mapper/plugins/associations/many_documents_proxy.rb', line 37

def replace(docs)
  load_target
  target.map(&:destroy)
  docs.each { |doc| apply_scope(doc).save }
  reset
end