123456789_123456789_123456789_123456789_123456789_

Exception: ActiveRecord::SoleRecordExceeded

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 Active Record finds multiple records but only expected one.

Class Method Summary

Instance Attribute Summary

Constructor Details

.new(record = nil) ⇒ SoleRecordExceeded

[ GitHub ]

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

def initialize(record = nil)
  @record = record
  super "Wanted only one #{record&.name || "record"}"
end

Instance Attribute Details

#record (readonly)

[ GitHub ]

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

attr_reader :record