mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 17:01:44 +02:00
Improve contact ident validation
- Make country-specific national id and reg. no validations fully extendable - Fix wrong error type for reg. no validator #569
This commit is contained in:
parent
48ae6cf471
commit
52452f91bf
6 changed files with 103 additions and 34 deletions
|
@ -5,8 +5,11 @@ class Contact::Ident
|
|||
attr_accessor :type
|
||||
attr_accessor :country_code
|
||||
|
||||
validates :code, presence: true, code: true
|
||||
validates :code, presence: true
|
||||
validates :code, national_id: true, if: :national_id?
|
||||
validates :code, reg_no: true, if: :reg_no?
|
||||
validates :code, iso8601: { date_only: true }, if: :birthday?
|
||||
|
||||
validates :type, presence: true, inclusion: { in: proc { types } }
|
||||
validates :country_code, presence: true, iso31661_alpha2: true
|
||||
validate :mismatched
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue