Module: MongoMapper::EmbeddedDocument::InstanceMethods
- Defined in:
- lib/mongo_mapper/embedded_document.rb
Instance Method Summary collapse
- #_parent_document=(value) ⇒ Object
- #destroyed? ⇒ Boolean
- #new? ⇒ Boolean
- #save(options = {}) ⇒ Object
- #save!(options = {}) ⇒ Object
Instance Method Details
#_parent_document=(value) ⇒ Object
65 66 67 68 |
# File 'lib/mongo_mapper/embedded_document.rb', line 65 def _parent_document=(value) @_root_document = value._root_document @_parent_document = value end |
#destroyed? ⇒ Boolean
43 44 45 |
# File 'lib/mongo_mapper/embedded_document.rb', line 43 def destroyed? !!_root_document.try(:destroyed?) end |
#new? ⇒ Boolean
47 48 49 |
# File 'lib/mongo_mapper/embedded_document.rb', line 47 def new? _root_document.try(:new?) || @new end |
#save(options = {}) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/mongo_mapper/embedded_document.rb', line 51 def save(={}) if result = _root_document.try(:save, ) @new = false end result end |
#save!(options = {}) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/mongo_mapper/embedded_document.rb', line 58 def save!(={}) if result = _root_document.try(:save!, ) @new = false end result end |