class ActiveModelSerializers::Adapter::JsonApi::Relationship

def data_for_one(association)

def data_for_one(association)
  if belongs_to_id_on_self?(association)
    id = parent_serializer.read_attribute_for_serialization(association.reflection.foreign_key)
    type =
      if association.polymorphic?
        # We can't infer resource type for polymorphic relationships from the serializer.
        # We can ONLY know a polymorphic resource type by inspecting each resource.
        association.lazy_association.serializer.json_key
      else
        association.reflection.type.to_s
      end
    ResourceIdentifier.for_type_with_id(type, id, serializable_resource_options)
  else
    # TODO(BF): Process relationship without evaluating lazy_association
    serializer = association.lazy_association.serializer
    if (virtual_value = association.virtual_value)
      virtual_value
    elsif serializer && association.object
      ResourceIdentifier.new(serializer, serializable_resource_options).as_json
    else
      nil
    end
  end
end