略過前往內容 略過前往搜尋

當 Active Record 找到多筆記錄,但預期僅有一筆時,會引發錯誤。

方法
N

屬性

[R] record

類別公開方法

new(record = nil)

# File activerecord/lib/active_record/errors.rb, line 195
def initialize(record = nil)
  @record = record
  super "Wanted only one #{record&.name || "record"}"
end