Exception: Ace::Support::Models::ModelNotFoundError

Inherits:
ValidationError show all
Defined in:
lib/ace/support/models/errors.rb

Overview

Model not found error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_id, suggestions: []) ⇒ ModelNotFoundError

Returns a new instance of ModelNotFoundError.



32
33
34
35
36
37
38
# File 'lib/ace/support/models/errors.rb', line 32

def initialize(model_id, suggestions: [])
  @model_id = model_id
  @suggestions = suggestions
  message = "Model '#{model_id}' not found"
  message += ". Did you mean: #{suggestions.join(", ")}?" if suggestions.any?
  super(message)
end

Instance Attribute Details

#model_idObject (readonly)

Returns the value of attribute model_id.



30
31
32
# File 'lib/ace/support/models/errors.rb', line 30

def model_id
  @model_id
end

#suggestionsObject (readonly)

Returns the value of attribute suggestions.



30
31
32
# File 'lib/ace/support/models/errors.rb', line 30

def suggestions
  @suggestions
end