demarches-normaliennes/app/models/siret.rb
2024-08-22 09:26:48 +02:00

19 lines
347 B
Ruby

# frozen_string_literal: true
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