module Graphiti::JsonapiSerializableExt::RendererOverrides

This library looks up a serializer based on the record’s class name This wouldn’t work for us, since a model may be associated with multiple resources. Instead, this variable is assigned when the query is resolved To ensure we always render with the resource serializer

Public Instance Methods

_build(object, exposures, _klass) click to toggle source
# File lib/graphiti/jsonapi_serializable_ext.rb, line 9
def _build(object, exposures, _klass)
  resource = object.instance_variable_get(:@__graphiti_resource)
  klass = object.instance_variable_get(:@__graphiti_serializer)
  klass.new(exposures.merge(object: object, resource: resource))
end