Exception: JSONAPI::Exceptions::InvalidInclude
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#relationship ⇒ Object
Returns the value of attribute relationship.
-
#resource ⇒ Object
Returns the value of attribute resource.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(resource, relationship) ⇒ InvalidInclude
constructor
A new instance of InvalidInclude.
Constructor Details
#initialize(resource, relationship) ⇒ InvalidInclude
Returns a new instance of InvalidInclude.
254 255 256 257 |
# File 'lib/jsonapi/exceptions.rb', line 254 def initialize(resource, relationship) @resource = resource @relationship = relationship end |
Instance Attribute Details
#relationship ⇒ Object
Returns the value of attribute relationship.
253 254 255 |
# File 'lib/jsonapi/exceptions.rb', line 253 def relationship @relationship end |
#resource ⇒ Object
Returns the value of attribute resource.
253 254 255 |
# File 'lib/jsonapi/exceptions.rb', line 253 def resource @resource end |
Instance Method Details
#errors ⇒ Object
259 260 261 262 263 264 265 266 267 |
# File 'lib/jsonapi/exceptions.rb', line 259 def errors [JSONAPI::Error.new(code: JSONAPI::INVALID_INCLUDE, status: :bad_request, title: I18n.translate('jsonapi-resources.exceptions.invalid_include.title', default: 'Invalid field'), detail: I18n.translate('jsonapi-resources.exceptions.invalid_include.detail', default: "#{relationship} is not a valid relationship of #{resource}", relationship: relationship, resource: resource))] end |