Class: JsonApiClient::Associations::BelongsTo::Association

Inherits:
JsonApiClient::Associations::BaseAssociation show all
Defined in:
lib/json_api_client/associations/belongs_to.rb

Instance Attribute Summary

Attributes inherited from JsonApiClient::Associations::BaseAssociation

#attr_name, #klass, #options

Instance Method Summary collapse

Methods inherited from JsonApiClient::Associations::BaseAssociation

#association_class, #initialize

Constructor Details

This class inherits a constructor from JsonApiClient::Associations::BaseAssociation

Instance Method Details

#paramObject



18
19
20
# File 'lib/json_api_client/associations/belongs_to.rb', line 18

def param
  :"#{attr_name}_id"
end

#parse(params) ⇒ Object



14
15
16
# File 'lib/json_api_client/associations/belongs_to.rb', line 14

def parse(params)
  params ? association_class.new(params) : nil
end

#to_prefix_pathObject



22
23
24
# File 'lib/json_api_client/associations/belongs_to.rb', line 22

def to_prefix_path
  "#{attr_name.to_s.pluralize}/%{#{param}}"
end