Module: MongoMapper::Plugins::EmbeddedDocument::InstanceMethods
- Defined in:
- lib/mongo_mapper/plugins/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
41 42 43 44 |
# File 'lib/mongo_mapper/plugins/embedded_document.rb', line 41 def _parent_document=(value) @_root_document = value._root_document @_parent_document = value end |
#destroyed? ⇒ Boolean
25 26 27 |
# File 'lib/mongo_mapper/plugins/embedded_document.rb', line 25 def destroyed? !!_root_document.try(:destroyed?) end |
#new? ⇒ Boolean
21 22 23 |
# File 'lib/mongo_mapper/plugins/embedded_document.rb', line 21 def new? _root_document.try(:new?) || @new end |
#save(options = {}) ⇒ Object
29 30 31 32 33 |
# File 'lib/mongo_mapper/plugins/embedded_document.rb', line 29 def save(={}) _root_document.try(:save, ).tap do |result| @new = false if result end end |
#save!(options = {}) ⇒ Object
35 36 37 38 39 |
# File 'lib/mongo_mapper/plugins/embedded_document.rb', line 35 def save!(={}) _root_document.try(:save, ).tap do |result| @new = false if result end end |