Exception: JSONAPI::Exceptions::InvalidRelationship
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#relationship_name ⇒ Object
Returns the value of attribute relationship_name.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Error
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(type, relationship_name, error_object_overrides = {}) ⇒ InvalidRelationship
constructor
A new instance of InvalidRelationship.
Methods inherited from Error
Constructor Details
#initialize(type, relationship_name, error_object_overrides = {}) ⇒ InvalidRelationship
Returns a new instance of InvalidRelationship.
333 334 335 336 337 |
# File 'lib/jsonapi/exceptions.rb', line 333 def initialize(type, relationship_name, error_object_overrides = {}) @relationship_name = relationship_name @type = type super(error_object_overrides) end |
Instance Attribute Details
#relationship_name ⇒ Object
Returns the value of attribute relationship_name.
331 332 333 |
# File 'lib/jsonapi/exceptions.rb', line 331 def relationship_name @relationship_name end |
#type ⇒ Object
Returns the value of attribute type.
331 332 333 |
# File 'lib/jsonapi/exceptions.rb', line 331 def type @type end |
Instance Method Details
#errors ⇒ Object
339 340 341 342 343 344 345 346 347 |
# File 'lib/jsonapi/exceptions.rb', line 339 def errors [create_error_object(code: JSONAPI::INVALID_RELATIONSHIP, status: :bad_request, title: I18n.translate('jsonapi-resources.exceptions.invalid_relationship.title', default: 'Invalid relationship'), detail: I18n.translate('jsonapi-resources.exceptions.invalid_relationship.detail', default: "#{relationship_name} is not a valid field for #{type}.", relationship_name: relationship_name, type: type))] end |