Module: Graphiti::ActiveGraph::Resource

Defined in:
lib/graphiti/active_graph/resource.rb,
lib/graphiti/active_graph/resource/interface.rb,
lib/graphiti/active_graph/resource/persistence.rb

Defined Under Namespace

Modules: Interface, Persistence

Instance Method Summary collapse

Instance Method Details

#all_with_preloaded(obj_arr, params) ⇒ Object



20
21
22
# File 'lib/graphiti/active_graph/resource.rb', line 20

def all_with_preloaded(obj_arr, params)
  build(params, nil, single: false, raise_on_missing: false, preloaded: obj_arr)
end

#guard_nil_id!(params) ⇒ Object



24
25
# File 'lib/graphiti/active_graph/resource.rb', line 24

def guard_nil_id!(params)
end

#relation_resource?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/graphiti/active_graph/resource.rb', line 4

def relation_resource?
  config[:relation_resource] || false
end

#relationship_resource=(value) ⇒ Object



8
9
10
# File 'lib/graphiti/active_graph/resource.rb', line 8

def relationship_resource=(value)
  config[:relation_resource] = value
end

#with_preloaded_obj(obj, params) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/graphiti/active_graph/resource.rb', line 12

def with_preloaded_obj(obj, params)
  id = params[:data].try(:[], :id) || params.delete(:id)
  params[:filter] ||= {}
  params[:filter][:id] = id if id

  build(params, nil, raise_on_missing: false, preloaded: obj)
end