mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
Refactor contact type parsing to dynamic
This commit is contained in:
parent
8bff2fb34c
commit
292daa66e0
2 changed files with 13 additions and 19 deletions
|
@ -31,18 +31,13 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def attach_contacts(contacts)
|
||||
contacts[:tech].each do |x|
|
||||
domain_contacts.create(
|
||||
contact: Contact.find_by(code: x[:contact]),
|
||||
contact_type: Contact::CONTACT_TYPE_TECH
|
||||
)
|
||||
end
|
||||
|
||||
contacts[:admin].each do |x|
|
||||
domain_contacts.create(
|
||||
contact: Contact.find_by(code: x[:contact]),
|
||||
contact_type: Contact::CONTACT_TYPE_ADMIN
|
||||
)
|
||||
contacts.each do |k, v|
|
||||
v.each do |x|
|
||||
domain_contacts.create(
|
||||
contact: Contact.find_by(code: x[:contact]),
|
||||
contact_type: k
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue