W3cubDocs

/Ruby on Rails 7.0

class ActiveRecord::SoleRecordExceeded

Parent:
ActiveRecord::ActiveRecordError

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

Attributes

record[R]

Public Class Methods

new(record = nil) Show source
# File activerecord/lib/active_record/errors.rb, line 149
def initialize(record = nil)
  @record = record
  super "Wanted only one #{record&.name || "record"}"
end
Calls superclass method

© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.