fix(Champs::CiviliteChamp): validates Champs::CiviliteChamp respecting it's validation context.

This commit is contained in:
mfo 2024-04-01 07:17:14 +02:00
parent 94ea16c894
commit ff527517c9
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC

View file

@ -1,5 +1,8 @@
class Champs::CiviliteChamp < Champ class Champs::CiviliteChamp < Champ
validates :value, inclusion: ["M.", "Mme"], allow_nil: true, allow_blank: false validates :value, inclusion: ["M.", "Mme"],
allow_nil: true,
allow_blank: false,
if: -> { validate_champ_value? || validation_context == :prefill }
def legend_label? def legend_label?
true true