Module: InstanceVariableOverride

Included in:
Object
Defined in:
lib/graphiti.rb

Overview

Because we set 2 magic variables when processing the graph, as_json will fail on a PORO with stack level too deep

#as_json calls #instance_variables, defined in active_support/core_ext/object/instance_variables.rb

So, override that to not see these magic vars.

Instance Method Summary collapse

Instance Method Details

#instance_valuesObject



220
221
222
223
224
225
226
227
228
# File 'lib/graphiti.rb', line 220

def instance_values
  values = super
  if @__graphiti_serializer
    values.reject! do |v|
      ["__graphiti_serializer", "__graphiti_resource"].include?(v)
    end
  end
  values
end