Class: JSONAPI::Association::HasOne

Inherits:
JSONAPI::Association show all
Defined in:
lib/jsonapi/association.rb

Instance Method Summary collapse

Methods inherited from JSONAPI::Association

#acts_as_set, #key, #primary_key, #serialize_type_name

Constructor Details

#initialize(name, options = {}) ⇒ HasOne



28
29
30
31
32
33
# File 'lib/jsonapi/association.rb', line 28

def initialize(name, options={})
  super
  class_name = options.fetch(:class_name, name.to_s.capitalize)
  @serialize_type_name = class_name.underscore.pluralize.to_sym
  @key ||= "#{name}_id".to_sym
end