From e344b97d51927c84f17a2ce819e9b6e7258f8301 Mon Sep 17 00:00:00 2001 From: sebastiencarceles Date: Thu, 26 Jan 2023 10:51:54 +0100 Subject: [PATCH] review: readability --- app/models/champs/multiple_drop_down_list_champ.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/champs/multiple_drop_down_list_champ.rb b/app/models/champs/multiple_drop_down_list_champ.rb index 29ce06dcf..4f14f197b 100644 --- a/app/models/champs/multiple_drop_down_list_champ.rb +++ b/app/models/champs/multiple_drop_down_list_champ.rb @@ -94,8 +94,9 @@ class Champs::MultipleDropDownListChamp < Champ end def values_are_in_options - return if (json = JSON.parse(value) - ['']).empty? - return if json.filter { |val| enabled_non_empty_options.exclude?(val) }.empty? + json = JSON.parse(value).reject(&:blank?) + return if json.empty? + return if (json - enabled_non_empty_options).empty? errors.add(:value, :not_in_options) end