Exception: JSONAPI::Exceptions::InvalidField
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(type, field) ⇒ InvalidField
constructor
A new instance of InvalidField.
Constructor Details
#initialize(type, field) ⇒ InvalidField
Returns a new instance of InvalidField.
236 237 238 239 |
# File 'lib/jsonapi/exceptions.rb', line 236 def initialize(type, field) @field = field @type = type end |
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
235 236 237 |
# File 'lib/jsonapi/exceptions.rb', line 235 def field @field end |
#type ⇒ Object
Returns the value of attribute type.
235 236 237 |
# File 'lib/jsonapi/exceptions.rb', line 235 def type @type end |
Instance Method Details
#errors ⇒ Object
241 242 243 244 245 246 247 248 249 |
# File 'lib/jsonapi/exceptions.rb', line 241 def errors [JSONAPI::Error.new(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 |