Class: ActiveForce::Association::RelationModelBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/active_force/association/relation_model_builder.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(association, value, association_mapping = {}) ⇒ RelationModelBuilder

Returns a new instance of RelationModelBuilder.



10
11
12
13
14
# File 'lib/active_force/association/relation_model_builder.rb', line 10

def initialize(association, value, association_mapping = {})
  @association = association
  @value = value
  @association_mapping = association_mapping
end

Class Method Details

.build(association, value, association_mapping = {}) ⇒ Object



5
6
7
# File 'lib/active_force/association/relation_model_builder.rb', line 5

def build(association, value, association_mapping = {})
  new(association, value, association_mapping).build_relation_model
end

Instance Method Details

#build_relation_modelObject



16
17
18
19
# File 'lib/active_force/association/relation_model_builder.rb', line 16

def build_relation_model
  klass = resolve_class
  klass.new(@association, @value, @association_mapping).call
end