Module: MongoMapper::EmbeddedDocument::InstanceMethods

Defined in:
lib/novelys_mongo_mapper/embedded_document.rb

Instance Method Summary collapse

Instance Method Details

#save(options = {}) ⇒ Object



42
43
44
45
46
47
# File 'lib/novelys_mongo_mapper/embedded_document.rb', line 42

def save(options={})
  if result = _root_document.try(:save, options)
    @new = false
  end
  result
end

#save!(options = {}) ⇒ Object



49
50
51
52
53
54
# File 'lib/novelys_mongo_mapper/embedded_document.rb', line 49

def save!(options={})
  if result = _root_document.try(:save!, options)
    @new = false
  end
  result
end

#update_attributes(attrs = {}) ⇒ Object



56
57
58
59
# File 'lib/novelys_mongo_mapper/embedded_document.rb', line 56

def update_attributes(attrs={})
  self.attributes = attrs
  self.save
end

#update_attributes!(attrs = {}) ⇒ Object



61
62
63
64
# File 'lib/novelys_mongo_mapper/embedded_document.rb', line 61

def update_attributes!(attrs={})
  self.attributes = attrs
  self.save!
end