Method: JSONAPI::Consumer::Resource::SerializerConcern#add_link

Defined in:
lib/jsonapi/consumer/resource/serializer_concern.rb


34
35
36
37
38
39
40
41
42
43
# File 'lib/jsonapi/consumer/resource/serializer_concern.rb', line 34

def add_link(name, association, options)
  return if association.nil?

  @hash[:links][name] = case association.class
                        when String, Integer
                          association
                        else
                          association.to_param
                        end
end