Class: JSONAPI::Relationship::ToMany
- Inherits:
-
JSONAPI::Relationship
- Object
- JSONAPI::Relationship
- JSONAPI::Relationship::ToMany
- Defined in:
- lib/jsonapi/relationship.rb
Instance Attribute Summary collapse
-
#inverse_relationship ⇒ Object
readonly
Returns the value of attribute inverse_relationship.
-
#reflect ⇒ Object
readonly
Returns the value of attribute reflect.
Attributes inherited from JSONAPI::Relationship
#acts_as_set, #always_include_linkage_data, #class_name, #eager_load_on_include, #foreign_key, #name, #options, #parent_resource, #polymorphic
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ ToMany
constructor
A new instance of ToMany.
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
Returns a new instance of ToMany.
85 86 87 88 89 90 91 |
# File 'lib/jsonapi/relationship.rb', line 85 def initialize(name, = {}) super @class_name = .fetch(:class_name, name.to_s.camelize.singularize) @foreign_key ||= "#{name.to_s.singularize}_ids".to_sym @reflect = .fetch(:reflect, true) == true @inverse_relationship = .fetch(:inverse_relationship, parent_resource._type.to_s.singularize.to_sym) if parent_resource end |
Instance Attribute Details
#inverse_relationship ⇒ Object (readonly)
Returns the value of attribute inverse_relationship.
83 84 85 |
# File 'lib/jsonapi/relationship.rb', line 83 def inverse_relationship @inverse_relationship end |
#reflect ⇒ Object (readonly)
Returns the value of attribute reflect.
83 84 85 |
# File 'lib/jsonapi/relationship.rb', line 83 def reflect @reflect end |