demarches-normaliennes/app/models/siret.rb
2016-05-24 15:43:05 +02:00

15 lines
298 B
Ruby

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!(' ') unless siret.nil?
end
end