Class: JSONAPI::Relationship::ToMany
- Inherits:
-
Relationship
- Object
- 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.
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ ToMany
constructor
A new instance of ToMany.
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 |