From c8ccac84f355ea2d84625e754d93bf7ef067828b Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 20 Apr 2016 14:43:55 +0300 Subject: [PATCH] Story#117991277 - validate contact with birthday cannot be Estonian --- app/models/contact.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 3e7ae4fc8..090e64866 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -81,7 +81,7 @@ class Contact < ActiveRecord::Base ORG = 'org' PRIV = 'priv' - BIRTHDAY = 'birthday' + BIRTHDAY = 'birthday'.freeze PASSPORT = 'passport' IDENT_TYPES = [ @@ -252,6 +252,8 @@ class Contact < ActiveRecord::Base if ident.size != 8 || !(ident =~/\A[0-9]{8}\z/) errors.add(:ident, err_msg) end + when BIRTHDAY + errors.add(:ident, err_msg) end end end @@ -284,6 +286,10 @@ class Contact < ActiveRecord::Base !org? end + def birthday? + ident_type == BIRTHDAY + end + def generate_auth_info return if @generate_auth_info_disabled return if auth_info.present?