Method: JSONAPI::Resource.apply_includes

Defined in:
lib/jsonapi/resource.rb

.apply_includes(records, options = {}) ⇒ Object



614
615
616
617
618
619
620
621
622
# File 'lib/jsonapi/resource.rb', line 614

def apply_includes(records, options = {})
  include_directives = options[:include_directives]
  if include_directives
    model_includes = resolve_relationship_names_to_relations(self, include_directives.model_includes, options)
    records = records.includes(model_includes)
  end

  records
end