champs: put champ label in numeric fields validation messages
Replaces > La valeur du champ doit être un nombre entier (sans chiffres après > la virgule) by > La valeur du champ « Nombre de parents » doit être un nombre entier > (sans chiffres après la virgule)
This commit is contained in:
parent
56c846900b
commit
10065df8ce
4 changed files with 20 additions and 4 deletions
|
@ -1,5 +1,11 @@
|
|||
class Champs::DecimalNumberChamp < Champ
|
||||
validates :value, numericality: { allow_nil: true, allow_blank: true }
|
||||
validates :value, numericality: {
|
||||
allow_nil: true,
|
||||
allow_blank: true,
|
||||
message: -> (object, data) {
|
||||
"« #{object.libelle} » " + object.errors.generate_message(data[:attribute].downcase, :not_a_number)
|
||||
}
|
||||
}
|
||||
|
||||
def for_export
|
||||
processed_value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue