class ActiveForce::Association::HasManyAssociationProjectionBuilder

Public Instance Methods

projections() click to toggle source

Use ActiveForce::Query to build a subquery for the SFDC relationship name. Per SFDC convention, the name needs to be pluralized

# File lib/active_force/association/eager_load_projection_builder.rb, line 42
def projections
  match = association.sfdc_association_field.match /__r\z/
  # pluralize the table name, and append '__r' if it was there to begin with
  relationship_name = association.sfdc_association_field.sub(match.to_s, '').pluralize + match.to_s
  query = Query.new relationship_name
  query.fields association.relation_model.fields
  ["(#{query.to_s})"]
end