跳至內文 跳至搜尋

當需要主鍵,但在 schema 或模型中未指定時,將會發生此例外狀況。

方法
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