diff --git a/app/models/champs/decimal_number_champ.rb b/app/models/champs/decimal_number_champ.rb index d7063cf8e..31278e52a 100644 --- a/app/models/champs/decimal_number_champ.rb +++ b/app/models/champs/decimal_number_champ.rb @@ -2,8 +2,8 @@ class Champs::DecimalNumberChamp < Champ validates :value, numericality: { allow_nil: true, allow_blank: true, - message: -> (object, data) { - "« #{object.libelle} » " + object.errors.generate_message(data[:attribute].downcase, :not_a_number) + message: -> (object, _data) { + "« #{object.libelle} » " + object.errors.generate_message(:value, :not_a_number) } } diff --git a/app/models/champs/integer_number_champ.rb b/app/models/champs/integer_number_champ.rb index c2c0ea254..082c73593 100644 --- a/app/models/champs/integer_number_champ.rb +++ b/app/models/champs/integer_number_champ.rb @@ -3,8 +3,8 @@ class Champs::IntegerNumberChamp < Champ only_integer: true, allow_nil: true, allow_blank: true, - message: -> (object, data) { - "« #{object.libelle} » " + object.errors.generate_message(data[:attribute].downcase, :not_an_integer) + message: -> (object, _data) { + "« #{object.libelle} » " + object.errors.generate_message(:value, :not_an_integer) } } diff --git a/config/locales/models/champs/fr.yml b/config/locales/models/champs/fr.yml index d1ab85d27..9d9e6b2f0 100644 --- a/config/locales/models/champs/fr.yml +++ b/config/locales/models/champs/fr.yml @@ -1,5 +1,5 @@ fr: activerecord: attributes: - champs: + champ: value: La valeur du champ