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)


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

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

Instance Attribute Details

#attrsHash (readonly)

Returns:

  • (Hash)


40
41
42
# File 'lib/occams-record/errors.rb', line 40

def attrs
  @attrs
end

#model_nameString (readonly)

Returns:

  • (String)


38
39
40
# File 'lib/occams-record/errors.rb', line 38

def model_name
  @model_name
end

Instance Method Details

#messageString

Returns:

  • (String)


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

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