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.
Attributes inherited from Error
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(resource, relationship, error_object_overrides = {}) ⇒ InvalidInclude
constructor
A new instance of InvalidInclude.
Methods inherited from Error
Constructor Details
#initialize(resource, relationship, error_object_overrides = {}) ⇒ InvalidInclude
Returns a new instance of InvalidInclude.
353 354 355 356 357 |
# File 'lib/jsonapi/exceptions.rb', line 353 def initialize(resource, relationship, error_object_overrides = {}) @resource = resource @relationship = relationship super(error_object_overrides) end |
Instance Attribute Details
#relationship ⇒ Object
Returns the value of attribute relationship.
351 352 353 |
# File 'lib/jsonapi/exceptions.rb', line 351 def relationship @relationship end |
#resource ⇒ Object
Returns the value of attribute resource.
351 352 353 |
# File 'lib/jsonapi/exceptions.rb', line 351 def resource @resource end |
Instance Method Details
#errors ⇒ Object
359 360 361 362 363 364 365 366 367 |
# File 'lib/jsonapi/exceptions.rb', line 359 def errors [create_error_object(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 includable relationship of #{resource}", relationship: relationship, resource: resource))] end |