123456789_123456789_123456789_123456789_123456789_

Exception: ActiveRecord::UnknownPrimaryKey

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, ActiveRecordError, StandardError
Instance Chain:
self, ActiveRecordError, StandardError
Inherits: ActiveRecord::ActiveRecordError
Defined in: activerecord/lib/active_record/errors.rb

Overview

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

Class Method Summary

Instance Attribute Summary

Constructor Details

.new(model = nil, description = nil) ⇒ UnknownPrimaryKey

[ GitHub ]

  
# File 'activerecord/lib/active_record/errors.rb', line 320

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

Instance Attribute Details

#model (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/errors.rb', line 318

attr_reader :model