Exception: OccamsRecord::NotFound

Inherits:
StandardError
  • Object
show all
Defined in:
lib/occams-record/errors.rb

Overview

Exception when a requested record couldn’t be found.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_name, attrs) ⇒ NotFound



65
66
67
# File 'lib/occams-record/errors.rb', line 65

def initialize(model_name, attrs)
  @model_name, @attrs = model_name, attrs
end

Instance Attribute Details

#attrsHash (readonly)



60
61
62
# File 'lib/occams-record/errors.rb', line 60

def attrs
  @attrs
end

#model_nameString (readonly)



58
59
60
# File 'lib/occams-record/errors.rb', line 58

def model_name
  @model_name
end

Instance Method Details

#messageString



75
76
77
# File 'lib/occams-record/errors.rb', line 75

def message
  "#{model_name} could not be found with #{attrs}!"
end

#to_sString



70
71
72
# File 'lib/occams-record/errors.rb', line 70

def to_s
  message
end