Module: ActiveForce::Association

Included in:
SObject
Defined in:
lib/active_force/association.rb,
lib/active_force/association/association.rb,
lib/active_force/association/has_many_association.rb,
lib/active_force/association/belongs_to_association.rb,
lib/active_force/association/relation_model_builder.rb,
lib/active_force/association/eager_load_projection_builder.rb

Defined Under Namespace

Classes: AbstractBuildFrom, AbstractProjectionBuilder, Association, BelongsToAssociation, BelongsToAssociationProjectionBuilder, BuildFromArray, BuildFromHash, BuildFromNilClass, BuildFromRestforce_Collection, BuildFromRestforce_Mash, BuildFromRestforce_SObject, EagerLoadProjectionBuilder, HasManyAssociation, HasManyAssociationProjectionBuilder, RelationModelBuilder

Instance Method Summary collapse

Instance Method Details

#associationsObject



9
10
11
# File 'lib/active_force/association.rb', line 9

def associations
  @associations ||= {}
end

#belongs_to(relation_name, options = {}) ⇒ Object



24
25
26
# File 'lib/active_force/association.rb', line 24

def belongs_to relation_name, options = {}
  associations[relation_name] = BelongsToAssociation.new(self, relation_name, options)
end

#find_association(name) ⇒ Object

i.e name = ‘Quota__r’



14
15
16
17
18
# File 'lib/active_force/association.rb', line 14

def find_association name
  associations.values.detect do |association|
    association.represents_sfdc_table? name
  end
end

#has_many(relation_name, options = {}) ⇒ Object



20
21
22
# File 'lib/active_force/association.rb', line 20

def has_many relation_name, options = {}
  associations[relation_name] = HasManyAssociation.new(self, relation_name, options)
end