class ActiveRecord::UnknownPrimaryKey

Parent:
ActiveRecord::ActiveRecordError

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

Attributes

model[R]

Public Class Methods

new(model = nil, description = nil) Show source
# File activerecord/lib/active_record/errors.rb, line 291
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
Calls superclass method

© 2004–2019 David Heinemeier Hansson
Licensed under the MIT License.