mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Remove contact code cache from domain contacts table
This commit is contained in:
parent
3852620180
commit
750bf0821c
11 changed files with 42 additions and 50 deletions
|
@ -6,32 +6,20 @@ class DomainContact < ApplicationRecord
|
|||
belongs_to :contact
|
||||
belongs_to :domain
|
||||
|
||||
validates :contact, presence: true
|
||||
|
||||
after_destroy :update_contact
|
||||
attr_accessor :value_typeahead
|
||||
|
||||
self.ignored_columns = %w[legacy_domain_id legacy_contact_id]
|
||||
|
||||
def epp_code_map
|
||||
{
|
||||
'2302' => [
|
||||
[:contact_code_cache, :taken, { value: { obj: 'contact', val: contact_code_cache } }]
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
def name
|
||||
return 'Tech' if type == 'TechDomainContact'
|
||||
return 'Admin' if type == 'AdminDomainContact'
|
||||
|
||||
''
|
||||
end
|
||||
|
||||
validates :contact, presence: true
|
||||
|
||||
before_save :update_contact_code_cache
|
||||
def update_contact_code_cache
|
||||
self.contact_code_cache = contact.code
|
||||
end
|
||||
|
||||
after_destroy :update_contact
|
||||
def update_contact
|
||||
Contact.find(contact_id).save
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue