Contact linked test update/refactor #2411

This commit is contained in:
Priit Tark 2015-07-27 15:59:23 +03:00
parent 7fa9fb3c6e
commit a9ba4dbfd2
7 changed files with 16 additions and 10 deletions

View file

@ -51,6 +51,9 @@ class Contact < ActiveRecord::Base
manage_ok
end
# for overwrite when doing children loop
attr_writer :domains_present
scope :current_registrars, ->(id) { where(registrar_id: id) }
BIC = 'bic'
@ -313,11 +316,6 @@ class Contact < ActiveRecord::Base
domain_contacts.present? || registrant_domains.present?
end
# for overwrite when doing children loop
def domains_present=(boolean)
@domains_present = boolean
end
def manage_linked
if domains_present?
set_linked

View file

@ -528,7 +528,7 @@ class Epp::Domain < Domain
return if registrant.registrar_id == registrar_id
is_other_domains_contact = DomainContact.where('contact_id = ? AND domain_id != ?', registrant_id, id).count > 0
if registrant.domains_owned.count > 1 || is_other_domains_contact
if registrant.registrant_domains.count > 1 || is_other_domains_contact
oc = copy_and_transfer_contact(registrant_id, registrar_id)
self.registrant_id = oc.id
else

View file

@ -8,7 +8,7 @@
%th{class: 'col-xs-4'}= t(:registrar)
%th{class: 'col-xs-4'}= t(:valid_to)
%tbody
- @contact.domains_owned.each do |x|
- @contact.registrant_domains.each do |x|
%tr
%td= link_to(x.name, [:admin, x])
%td= link_to(x.registrar, [:admin, x.registrar])