Exception: ActiveRecord::UnknownPrimaryKey

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

Overview

Raised when a primary key is needed, but not specified in the schema or model.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, description = nil) ⇒ UnknownPrimaryKey


222
223
224
225
226
227
# File 'activerecord/lib/active_record/errors.rb', line 222

def initialize(model, description = nil)
  message = "Unknown primary key for table #{model.table_name} in model #{model}."
  message += "\n#{description}" if description
  super(message)
  @model = model
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model


220
221
222
# File 'activerecord/lib/active_record/errors.rb', line 220

def model
  @model
end