mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 08:52:04 +02:00
Test on domain adding
This commit is contained in:
parent
211964c296
commit
2a4c46e870
3 changed files with 48 additions and 2 deletions
|
@ -27,6 +27,7 @@ class Domain < ActiveRecord::Base
|
|||
delegate :name, to: :registrar, prefix: true
|
||||
|
||||
before_create :generate_auth_info
|
||||
after_create :attach_default_contacts
|
||||
|
||||
validates :name_dirty, domain_name: true, uniqueness: true
|
||||
validates :period, numericality: { only_integer: true }
|
||||
|
@ -106,6 +107,11 @@ class Domain < ActiveRecord::Base
|
|||
end while self.class.exists?(auth_info: auth_info)
|
||||
end
|
||||
|
||||
def attach_default_contacts
|
||||
tech_contacts << owner_contact if tech_contacts_count.zero?
|
||||
admin_contacts << owner_contact if admin_contacts_count.zero? && owner_contact.citizen?
|
||||
end
|
||||
|
||||
def tech_contacts_count
|
||||
domain_contacts.select { |x| x.contact_type == DomainContact::TECH }.count
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue