class JSONAPI::Exceptions::InvalidField

Attributes

field[RW]
type[RW]

Public Class Methods

new(type, field, error_object_overrides = {}) click to toggle source
Calls superclass method JSONAPI::Exceptions::Error::new
# File lib/jsonapi/exceptions.rb, line 313
def initialize(type, field, error_object_overrides = {})
  @field = field
  @type = type
  super(error_object_overrides)
end

Public Instance Methods

errors() click to toggle source
# File lib/jsonapi/exceptions.rb, line 319
def errors
  [create_error_object(code: JSONAPI::INVALID_FIELD,
                       status: :bad_request,
                       title: I18n.translate('jsonapi-resources.exceptions.invalid_field.title',
                                             default: 'Invalid field'),
                       detail: I18n.translate('jsonapi-resources.exceptions.invalid_field.detail',
                                              default: "#{field} is not a valid field for #{type}.",
                                              field: field, type: type))]
end