Fix number champs validation

This commit is contained in:
Paul Chavard 2018-11-29 14:35:42 +01:00
parent 034b3f600b
commit ca147969ab
4 changed files with 26 additions and 2 deletions

View file

@ -1,5 +1,5 @@
class Champs::DecimalNumberChamp < Champ
validates :value, numericality: { allow_nil: true }
validates :value, numericality: { allow_nil: true, allow_blank: true }
def value_for_export
value.to_f

View file

@ -1,5 +1,5 @@
class Champs::IntegerNumberChamp < Champ
validates :value, numericality: { only_integer: true, allow_nil: true }
validates :value, numericality: { only_integer: true, allow_nil: true, allow_blank: true }
def value_for_export
value.to_i