Class: JSONAPI::Association
- Inherits:
-
Object
- Object
- JSONAPI::Association
- Defined in:
- lib/jsonapi/association.rb
Defined Under Namespace
Instance Method Summary collapse
- #acts_as_set ⇒ Object
-
#initialize(name, options = {}) ⇒ Association
constructor
A new instance of Association.
- #key ⇒ Object
- #primary_key ⇒ Object
- #serialize_type_name ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Association
Returns a new instance of Association.
3 4 5 6 7 8 9 |
# File 'lib/jsonapi/association.rb', line 3 def initialize(name, ={}) @name = name.to_s = @key = [:key] ? [:key].to_sym : nil @primary_key = .fetch(:primary_key, 'id').to_sym @acts_as_set = .fetch(:acts_as_set, false) == true end |
Instance Method Details
#acts_as_set ⇒ Object
19 20 21 |
# File 'lib/jsonapi/association.rb', line 19 def acts_as_set @acts_as_set end |
#key ⇒ Object
11 12 13 |
# File 'lib/jsonapi/association.rb', line 11 def key @key end |
#primary_key ⇒ Object
15 16 17 |
# File 'lib/jsonapi/association.rb', line 15 def primary_key @primary_key end |
#serialize_type_name ⇒ Object
23 24 25 |
# File 'lib/jsonapi/association.rb', line 23 def serialize_type_name @serialize_type_name end |