From 08b0633ed4028c4f03474117fe394723dedce1a4 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 30 Nov 2015 14:49:26 +0200 Subject: [PATCH 1/2] Story#109014746 - ident_country_code should be only on create for now --- app/models/contact.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 20c11ae80..9521cbb9b 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -23,7 +23,7 @@ class Contact < ActiveRecord::Base validates :ident, format: { with: /\d{4}-\d{2}-\d{2}/, message: :invalid_birthday_format }, if: proc { |c| c.ident_type == 'birthday' } - validates :ident_country_code, presence: true, if: proc { |c| %w(org priv).include? c.ident_type } + validates :ident_country_code, presence: true, if: proc { |c| %w(org priv).include? c.ident_type }, on: :create validates :code, uniqueness: { message: :epp_id_taken }, format: { with: /\A[\w\-\:]*\Z/i, message: :invalid }, From 94cf904469446ee80428398d08669a6cb7ebe95b Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 30 Nov 2015 14:55:40 +0200 Subject: [PATCH 2/2] Story#109014746 - delegate ident_attr_valid? to class --- app/models/epp/contact.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 435a63dee..ec5673b06 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -104,6 +104,7 @@ class Epp::Contact < Contact res end end + delegate :ident_attr_valid?, to: :class def epp_code_map # rubocop:disable Metrics/MethodLength {