Module: Graphiti::ActiveGraph::SideloadResolve

Included in:
ResourceProxy
Defined in:
lib/graphiti/active_graph/sideload_resolve.rb

Constant Summary collapse

PRELOAD_METHOD_PREFIX =
'preload_'.freeze

Instance Method Summary collapse

Instance Method Details

#initialize(object, resource, query, opts = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/graphiti/active_graph/sideload_resolve.rb', line 5

def initialize(object, resource, query, opts = {})
  @object = object
  @resource = resource
  @query = query
  @opts = opts
  @unpaginated_object = opts[:unpaginated_query].presence || @object

  return if opts[:preloaded]
  @object = @resource.around_scoping(@object, @query.hash) { |scope|
    apply_scoping(scope, opts)
  }
end

#resolveObject



21
22
23
# File 'lib/graphiti/active_graph/sideload_resolve.rb', line 21

def resolve
  super.tap { |results| preload_extra_fields(results) }
end

#resolve_sideloads(parents) ⇒ Object



18
19
# File 'lib/graphiti/active_graph/sideload_resolve.rb', line 18

def resolve_sideloads(parents)
end