Skip to Content Skip to Search

class ActiveRecord::SoleRecordExceeded

Raised when Active Record finds multiple records but only expected one.

Inherits From

Attributes

[R] record

Public class methods

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

Definition files