[Fix #2623] Ensure numbers are integers

This commit is contained in:
gregoirenovel 2018-09-21 08:10:02 +02:00
parent dd76c068fc
commit 68789ff43b
2 changed files with 7 additions and 1 deletions

View file

@ -1,2 +1,6 @@
class Champs::NumberChamp < Champ
validates :value, numericality: { message: Proc.new { |champ, _| "#{champ.libelle} doit être un nombre" } }
validates :value,
numericality: { only_integer: true, message: Proc.new { |champ, _| "#{champ.libelle} doit être un nombre entier" } },
if: Proc.new{ |object| object.errors.empty? }
end