Exception: ActiveRecord::UnknownPrimaryKey

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ UnknownPrimaryKey

Returns a new instance of UnknownPrimaryKey.



190
191
192
193
# File 'lib/active_record/errors.rb', line 190

def initialize(model)
  super("Unknown primary key for table #{model.table_name} in model #{model}.")
  @model = model
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



188
189
190
# File 'lib/active_record/errors.rb', line 188

def model
  @model
end