fix(champ): allow to submit when secondary options are empty

This commit is contained in:
Paul Chavard 2022-07-19 19:01:53 +02:00
parent 36df41c1e4
commit e85fe71887
6 changed files with 85 additions and 53 deletions

View file

@ -83,13 +83,13 @@ class Champs::LinkedDropDownListChamp < Champ
[primary_value, secondary_value]
end
def has_secondary_options_for_primary?
primary_value.present? && secondary_options[primary_value]&.any?(&:present?)
end
private
def pack_value(primary, secondary)
self.value = JSON.generate([primary, secondary])
end
def has_secondary_options_for_primary?
primary_value.present? && secondary_options[primary_value]&.any?(&:present?)
end
end