Class: ActiveForce::Association::BelongsToAssociationProjectionBuilder

Inherits:
AbstractProjectionBuilder show all
Defined in:
lib/active_force/association/eager_load_projection_builder.rb

Instance Attribute Summary

Attributes inherited from AbstractProjectionBuilder

#association, #parent_association_field, #query_fields

Instance Method Summary collapse

Methods inherited from AbstractProjectionBuilder

#apply_association_scope, #initialize, #query_with_association_fields

Constructor Details

This class inherits a constructor from ActiveForce::Association::AbstractProjectionBuilder

Instance Method Details

#projectionsObject



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 77

def projections
  association_field = if parent_association_field.present?
                        "#{ parent_association_field }.#{ association.sfdc_association_field }"
                      else
                        association.sfdc_association_field
                      end
  selected_fields = query_fields || association.relation_model.fields
  selected_fields.map do |field|
    "#{ association_field }.#{ field }"
  end
end