demarches-normaliennes/app/models/siret.rb
2018-10-01 16:15:46 +02:00

17 lines
316 B
Ruby

class Siret
include ActiveModel::Model
include ActiveModel::Validations::Callbacks
attr_accessor :siret
validates :siret, presence: true
validates :siret, siret_format: true
before_validation :remove_whitespace
def remove_whitespace
if siret.present?
siret.delete!(' ')
end
end
end