Use if/else instead of case without argument

This commit is contained in:
Rafael Mendonça França 2020-12-29 23:54:34 +00:00
parent 8695b02826
commit cc2e097fed
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
1 changed files with 2 additions and 3 deletions

View File

@ -112,10 +112,9 @@ module ActiveRecord
def sole
found, undesired = first(2)
case
when found.nil?
if found.nil?
raise_record_not_found_exception!
when undesired.present?
elsif undesired.present?
raise ActiveRecord::SoleRecordExceeded.new(self)
else
found