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
42 43 44 45 |
# File 'lib/mongo_mapper/plugins/embedded_document.rb', line 42 def _parent_document=(value) @_root_document = value._root_document @_parent_document = value end |
#destroyed? ⇒ Boolean
26 27 28 |
# File 'lib/mongo_mapper/plugins/embedded_document.rb', line 26 def destroyed? !!_root_document.try(:destroyed?) end |
#new? ⇒ Boolean
22 23 24 |
# File 'lib/mongo_mapper/plugins/embedded_document.rb', line 22 def new? _root_document.try(:new?) || @_new end |
#save(options = {}) ⇒ Object
30 31 32 33 34 |
# File 'lib/mongo_mapper/plugins/embedded_document.rb', line 30 def save(={}) _root_document.try(:save, ).tap do |result| @_new = false if result end end |
#save!(options = {}) ⇒ Object
36 37 38 39 40 |
# File 'lib/mongo_mapper/plugins/embedded_document.rb', line 36 def save!(={}) _root_document.try(:save, ).tap do |result| @_new = false if result end end |