Exception: JSONAPI::Exceptions::RecordNotFound

Inherits:
Error
  • Object
show all
Defined in:
lib/jsonapi/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ RecordNotFound


47
48
49
# File 'lib/jsonapi/exceptions.rb', line 47

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject

Returns the value of attribute id


46
47
48
# File 'lib/jsonapi/exceptions.rb', line 46

def id
  @id
end

Instance Method Details

#errorsObject


51
52
53
54
55
56
57
58
# File 'lib/jsonapi/exceptions.rb', line 51

def errors
  [JSONAPI::Error.new(code: JSONAPI::RECORD_NOT_FOUND,
                      status: :not_found,
                      title: I18n.translate('jsonapi-resources.exceptions.record_not_found.title',
                                            default: 'Record not found'),
                      detail: I18n.translate('jsonapi-resources.exceptions.record_not_found.detail',
                                             default: "The record identified by #{id} could not be found.", id: id))]
end