diff --git a/app/models/siret.rb b/app/models/siret.rb index de274b5a1..0bac4702b 100644 --- a/app/models/siret.rb +++ b/app/models/siret.rb @@ -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