Module: Mongoid::Associations::InstanceMethods
- Defined in:
- lib/mongoid/associations.rb
Instance Method Summary collapse
-
#associations ⇒ Object
Returns the associations for the
Document
. -
#update_association(name) ⇒ Object
Update the one-to-one relational association for the name.
-
#update_associations(name) ⇒ Object
Updates all the one-to-many relational associations for the name.
Instance Method Details
#associations ⇒ Object
Returns the associations for the Document
.
27 28 29 |
# File 'lib/mongoid/associations.rb', line 27 def associations self.class.associations end |
#update_association(name) ⇒ Object
Update the one-to-one relational association for the name.
37 38 39 40 |
# File 'lib/mongoid/associations.rb', line 37 def update_association(name) association = send(name) association.save if new_record? && !association.nil? end |
#update_associations(name) ⇒ Object
Updates all the one-to-many relational associations for the name.
32 33 34 |
# File 'lib/mongoid/associations.rb', line 32 def update_associations(name) send(name).each { |doc| doc.save } if new_record? end |