From cc2e097fed5ba82b895dac3ecd25e455b04e9eda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 29 Dec 2020 23:54:34 +0000 Subject: [PATCH] Use if/else instead of case without argument --- activerecord/lib/active_record/relation/finder_methods.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 3eea5fa157..0dbf9a2208 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -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