Handle siret with whitespaces
This commit is contained in:
parent
9aca554eb2
commit
d9b94568b2
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue