class ActiveForce::Association::HasManyAssociation
Public Instance Methods
sfdc_association_field()
click to toggle source
# File lib/active_force/association/has_many_association.rb, line 4 def sfdc_association_field name = relationship_name.gsub(/__c\z/, '__r') match = name.match(/__r\z/) # pluralize the table name, and append '__r' if it was there to begin with name.sub(match.to_s, '').pluralize + match.to_s end
Private Instance Methods
default_foreign_key()
click to toggle source
# File lib/active_force/association/has_many_association.rb, line 13 def default_foreign_key infer_foreign_key_from_model parent end
define_assignment_method()
click to toggle source
# File lib/active_force/association/has_many_association.rb, line 25 def define_assignment_method method_name = relation_name parent.send :define_method, "#{method_name}=" do |associated| association_cache[method_name] = associated end end
target(owner)
click to toggle source
# File lib/active_force/association/has_many_association.rb, line 17 def target(owner) apply_scope(relation_model.query, owner).where(foreign_key => owner.id) end
target_when_unloadable()
click to toggle source
# File lib/active_force/association/has_many_association.rb, line 21 def target_when_unloadable relation_model.none end