Exception: ActiveRecord::RecordNotFound

Inherits:
ActiveRecordError show all
Defined in:
activerecord/lib/active_record/errors.rb

Overview

Raised when Active Record cannot find a record by given id or set of ids.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, model = nil, primary_key = nil, id = nil) ⇒ RecordNotFound

Returns a new instance of RecordNotFound.


55
56
57
58
59
60
61
# File 'activerecord/lib/active_record/errors.rb', line 55

def initialize(message = nil, model = nil, primary_key = nil, id = nil)
  @primary_key = primary_key
  @model = model
  @id = id

  super(message)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id


53
54
55
# File 'activerecord/lib/active_record/errors.rb', line 53

def id
  @id
end

#modelObject (readonly)

Returns the value of attribute model


53
54
55
# File 'activerecord/lib/active_record/errors.rb', line 53

def model
  @model
end

#primary_keyObject (readonly)

Returns the value of attribute primary_key


53
54
55
# File 'activerecord/lib/active_record/errors.rb', line 53

def primary_key
  @primary_key
end