def group_present(models, requested_associations = [], options = {})
      association_objects_by_name = requested_associations.each_with_object({}) do |assoc_name, memo|
        memo[assoc_name.to_s] = configuration[:associations][assoc_name] if configuration[:associations][assoc_name]
      end

      # It's slightly ugly, but more efficient if we pre-load everything we
      # need and pass it through.
      context = {
        conditional_cache:            { request: {} },
        fields:                       configuration[:fields],
        conditionals:                 configuration[:conditionals],
        associations:                 configuration[:associations],
        reflections:                  reflections_for_model(models.first),
        association_objects_by_name:  association_objects_by_name,
        optional_fields:              options[:optional_fields] || [],
        models:                       models,
        lookup:                       empty_lookup_cache(configuration[:fields].keys, association_objects_by_name.keys)
      }

      sanitized_association_names = association_objects_by_name.values.map(&:method_name)
      preload_associations! models, sanitized_association_names, context[:reflections]

      # Legacy: Overridable for custom preload behavior.
      custom_preload(models, association_objects_by_name.keys)

      models.map do |model|
        context[:conditional_cache][:model] = {}
        context[:helper_instance] = fresh_helper_instance
        result = present_fields(model, context, context[:fields])
        load_associations!(model, result, context, options)
        add_id!(model, result)
        datetimes_to_json(result)
      end
    end
def group_present(models, requested_associations = [], options = {})
      association_objects_by_name = requested_associations.each_with_object({}) do |assoc_name, memo|
        memo[assoc_name.to_s] = configuration[:associations][assoc_name] if configuration[:associations][assoc_name]
      end

      # It's slightly ugly, but more efficient if we pre-load everything we
      # need and pass it through.
      context = {
        conditional_cache:            { request: {} },
        fields:                       configuration[:fields],
        conditionals:                 configuration[:conditionals],
        associations:                 configuration[:associations],
        reflections:                  reflections_for_model(models.first),
        association_objects_by_name:  association_objects_by_name,
        optional_fields:              options[:optional_fields] || [],
        models:                       models,
        lookup:                       empty_lookup_cache(configuration[:fields].keys, association_objects_by_name.keys)
      }

      sanitized_association_names = association_objects_by_name.values.map(&:method_name)
      preload_associations! models, sanitized_association_names, context[:reflections]

      # Legacy: Overridable for custom preload behavior.
      custom_preload(models, association_objects_by_name.keys)

      models.map do |model|
        context[:conditional_cache][:model] = {}
        context[:helper_instance] = fresh_helper_instance
        result = present_fields(model, context, context[:fields])
        load_associations!(model, result, context, options)
        add_id!(model, result)
        datetimes_to_json(result)
      end
    end
Calls {#custom_preload} and then presents all models.
 @params [ActiveRecord::Relation, Array] models
 @params [Array] requested_associations An array of permitted lower-case string association names, e.g. 'post'
 @params [Hash] options The options passed to `load_associations!`