Story#109590460 - update country code validation

This commit is contained in:
Vladimir Krylov 2015-12-14 14:25:28 +02:00
parent ffb8bc61dd
commit b5b0dc7f21

View file

@ -219,7 +219,7 @@ class Contact < ActiveRecord::Base
errors.add(:ident, :invalid_EE_identity_format) unless Isikukood.new(ident).valid? errors.add(:ident, :invalid_EE_identity_format) unless Isikukood.new(ident).valid?
when 'org'.freeze when 'org'.freeze
# !%w(1 7 8 9).freeze.include?(ident.first) || # !%w(1 7 8 9).freeze.include?(ident.first) ||
if ident.size != 8 || ident !=~/\A[0-9]{8}\z/ if ident.size != 8 || !(ident =~/\A[0-9]{8}\z/)
errors.add(:ident, :invalid_EE_identity_format) errors.add(:ident, :invalid_EE_identity_format)
end end
end end