Module: Humanoid::Associations::InstanceMethods

Defined in:
lib/humanoid/associations.rb

Instance Method Summary collapse

Instance Method Details

#associationsObject

Returns the associations for the Document.



25
26
27
# File 'lib/humanoid/associations.rb', line 25

def associations
  self.class.associations
end

#update_association(name) ⇒ Object

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



35
36
37
38
# File 'lib/humanoid/associations.rb', line 35

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.



30
31
32
# File 'lib/humanoid/associations.rb', line 30

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