mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 01:11:43 +02:00
Merge pull request #57 from internetee/story/109590460-setting-ident
Story/109590460 setting ident
This commit is contained in:
commit
438b22f19d
2 changed files with 23 additions and 19 deletions
|
@ -236,12 +236,16 @@ class Contact < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def ident_valid_format?
|
||||
case ident_type
|
||||
when 'priv'
|
||||
case ident_country_code
|
||||
when 'EE'
|
||||
code = Isikukood.new(ident)
|
||||
errors.add(:ident, :invalid_EE_identity_format) unless code.valid?
|
||||
case ident_country_code
|
||||
when 'EE'.freeze
|
||||
case ident_type
|
||||
when 'priv'.freeze
|
||||
errors.add(:ident, :invalid_EE_identity_format) unless Isikukood.new(ident).valid?
|
||||
when 'org'.freeze
|
||||
# !%w(1 7 8 9).freeze.include?(ident.first) ||
|
||||
if ident.size != 8 || !(ident =~/\A[0-9]{8}\z/)
|
||||
errors.add(:ident, :invalid_EE_identity_format)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue