Exception: Caprese::AssociationNotFoundError

Inherits:
Error
  • Object
show all
Defined in:
lib/caprese/errors.rb

Overview

Thrown when an association was not found when calling ‘record.association()`

Instance Attribute Summary

Attributes inherited from Error

#code, #field, #header, #t

Instance Method Summary collapse

Methods inherited from Error

#as_json, #i18n_scope, #with_header

Constructor Details

#initialize(name) ⇒ AssociationNotFoundError

Returns a new instance of AssociationNotFoundError.



57
58
59
60
# File 'lib/caprese/errors.rb', line 57

def initialize(name)
  super field: :name, code: :not_found, t: { model: 'relationship', value: name }
  @header = { status: :not_found }
end

Instance Method Details

#full_messageObject



62
63
64
# File 'lib/caprese/errors.rb', line 62

def full_message
  I18n.t("#{i18n_scope}.parameters.not_found", t)
end