Method: JSONAPI::Resource.relationship
- Defined in:
- lib/jsonapi/resource.rb
.relationship(*attrs) ⇒ Object
504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
# File 'lib/jsonapi/resource.rb', line 504 def relationship(*attrs) = attrs. klass = case [:to] when :one Relationship::ToOne when :many Relationship::ToMany else #:nocov:# fail ArgumentError.new('to: must be either :one or :many') #:nocov:# end _add_relationship(klass, *attrs, .except(:to)) end |