Handle siret with whitespaces

This commit is contained in:
Guillaume Lazzara 2016-05-24 15:28:16 +02:00
parent 9aca554eb2
commit d9b94568b2

View file

@ -1,7 +1,15 @@
class Siret
include ActiveModel::Model
include ActiveModel::Validations::Callbacks
attr_accessor :siret
validates_presence_of :siret
validates :siret, siret_format: true
before_validation :remove_whitespace
def remove_whitespace
siret.delete!(' ')
end
end