Method: MongoMapper::Associations::ManyDocumentsProxy#replace

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

#replace(docs) ⇒ Object



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

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