demarches-normaliennes/app/models/siret.rb
2018-03-06 17:18:44 +01:00

15 lines
302 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
siret.delete!(' ') if siret.present?
end
end