跳至内容 跳至搜索

当需要主键但未在模式或模型中指定时引发此异常。

方法
N

属性

[R] model

类公共方法

new(model = nil, description = nil)

# 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