Module: Mongoid::Relations::Cyclic::ClassMethods
- Defined in:
- lib/mongoid/relations/cyclic.rb
Instance Method Summary collapse
-
#recursively_embeds_many(options = {}) ⇒ Object
Create a cyclic embedded relation that creates a tree hierarchy for the document and many embedded child documents.
-
#recursively_embeds_one(options = {}) ⇒ Object
Create a cyclic embedded relation that creates a single self referencing relationship for a parent and a single child.
Instance Method Details
#recursively_embeds_many(options = {}) ⇒ Object
Create a cyclic embedded relation that creates a tree hierarchy for the document and many embedded child documents.
This provides the default nomenclature for accessing a parent document or its children.
38 39 40 41 42 43 44 |
# File 'lib/mongoid/relations/cyclic.rb', line 38 def ( = {}) ( cyclic_child_name, .merge(class_name: self.name, cyclic: true) ) cyclic_parent_name, class_name: self.name, cyclic: true end |
#recursively_embeds_one(options = {}) ⇒ Object
Create a cyclic embedded relation that creates a single self referencing relationship for a parent and a single child.
This provides the default nomenclature for accessing a parent document or its children.
68 69 70 71 72 73 74 |
# File 'lib/mongoid/relations/cyclic.rb', line 68 def ( = {}) ( cyclic_child_name(false), .merge(class_name: self.name, cyclic: true) ) cyclic_parent_name, class_name: self.name, cyclic: true end |