Add bullet workaround #2825

This commit is contained in:
Martin Lensment 2015-09-11 13:06:30 +03:00
parent a2b6409460
commit 2ee65aa950

View file

@ -12,8 +12,13 @@ class Epp::Domain < Domain
after_validation :validate_contacts after_validation :validate_contacts
def validate_contacts def validate_contacts
ok = true ok = true
ac = admin_domain_contacts.includes(:contact).select { |x| !x.marked_for_destruction? }.map(&:contact) active_admins = admin_domain_contacts.select { |x| !x.marked_for_destruction? }
tc = tech_domain_contacts.includes(:contact).select { |x| !x.marked_for_destruction? }.map(&:contact) active_techs = tech_domain_contacts.select { |x| !x.marked_for_destruction? }
# bullet workaround
ac = active_admins.map { |x| Contact.find(x.contact_id) }
tc = active_techs.map { |x| Contact.find(x.contact_id) }
# validate registrant here as well # validate registrant here as well
([registrant] + ac + tc).each do |x| ([registrant] + ac + tc).each do |x|
unless x.valid? unless x.valid?