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)


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

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

Instance Attribute Details

#attrsHash (readonly)

Returns:

  • (Hash)


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

def attrs
  @attrs
end

#model_nameString (readonly)

Returns:

  • (String)


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

def model_name
  @model_name
end

Instance Method Details

#messageString

Returns:

  • (String)


63
64
65
# File 'lib/occams-record/errors.rb', line 63

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

#to_sString

Returns:

  • (String)


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

def to_s
  message
end