Class: JSONAPI::Relationship::ToMany

Inherits:
JSONAPI::Relationship show all
Defined in:
lib/jsonapi/relationship.rb

Instance Attribute Summary

Attributes inherited from JSONAPI::Relationship

#acts_as_set, #always_include_linkage_data, #class_name, #foreign_key, #name, #options, #parent_resource, #polymorphic

Instance Method Summary collapse

Methods inherited from JSONAPI::Relationship

#belongs_to?, #primary_key, #relation_name, #resource_klass, #table_name, #type, #type_for_source

Constructor Details

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


82
83
84
85
86
# File 'lib/jsonapi/relationship.rb', line 82

def initialize(name, options = {})
  super
  @class_name = options.fetch(:class_name, name.to_s.camelize.singularize)
  @foreign_key ||= "#{name.to_s.singularize}_ids".to_sym
end