Skip to Content Skip to Search

class ActiveRecord::UnknownPrimaryKey

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

Inherits From

Attributes

[R] model

Public class methods

Source code GitHub
# File activerecord/lib/active_record/errors.rb, line 475
def initialize(model = nil, description = nil)
  if model
    message = "Unknown primary key for table #{model.table_name} in model #{model}."
    message += "\n#{description}" if description
    @model = model
    super(message)
  else
    super("Unknown primary key.")
  end
end

Definition files