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

Returns a new instance of NotFound.

Parameters:

  • model_name (String)
  • attrs (Hash)


49
50
51
# File 'lib/occams-record/errors.rb', line 49

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

Instance Attribute Details

#attrsHash (readonly)

Returns:

  • (Hash)


45
46
47
# File 'lib/occams-record/errors.rb', line 45

def attrs
  @attrs
end

#model_nameString (readonly)

Returns:

  • (String)


43
44
45
# File 'lib/occams-record/errors.rb', line 43

def model_name
  @model_name
end

Instance Method Details

#messageString

Returns:

  • (String)


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

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

#to_sString

Returns:

  • (String)


54
55
56
# File 'lib/occams-record/errors.rb', line 54

def to_s
  message
end