2021/04/19分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
activesupport/lib/active_support/core_ext/enumerable.rb
の修正です。
Enumerable
に、1レコードを取得、かつ、レコードが1つじゃない場合にexceptionをraiseするEnumerable#sole
を追加しています。Add ActiveRecord::FinderMethods#sole and #find_sole_by で追加されたActiveRecord::FinderMethods#sole
のEnumerable
版。
["x"].sole # => "x" Set.new.sole # => Enumerable::SoleItemExpectedError: no item found { a: 1, b: 2 }.sole # => Enumerable::SoleItemExpectedError: multiple items found