Method: Graphiti.with_context

Defined in:
lib/graphiti.rb

.with_context(obj, namespace = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/graphiti.rb', line 35

def self.with_context(obj, namespace = nil)
  prior = context
  self.context = {object: obj, namespace: namespace}
  yield
ensure
  self.context = prior

  resources.each do |resource_class|
    resource_class.sideloads.values.each(&:clear_resources)
  end
end