Module: Mongoid::Associations::InstanceMethods

Defined in:
lib/mongoid/associations.rb

Instance Method Summary collapse

Instance Method Details

#associationsObject

Returns the associations for the Document.



21
22
23
# File 'lib/mongoid/associations.rb', line 21

def associations
  self.class.associations
end

#update_association(name) ⇒ Object

Update the one-to-one relational association for the name.



31
32
33
34
# File 'lib/mongoid/associations.rb', line 31

def update_association(name)
  association = send(name)
  association.save unless association.nil?
end

#update_associations(name) ⇒ Object

Updates all the one-to-many relational associations for the name.



26
27
28
# File 'lib/mongoid/associations.rb', line 26

def update_associations(name)
  send(name).each { |doc| doc.save }
end