From 2ee65aa9507424682930c1673cc643f0dfe6ff08 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Fri, 11 Sep 2015 13:06:30 +0300 Subject: [PATCH] Add bullet workaround #2825 --- app/models/epp/domain.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 236adb786..34d0e01e3 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -12,8 +12,13 @@ class Epp::Domain < Domain after_validation :validate_contacts def validate_contacts ok = true - ac = admin_domain_contacts.includes(:contact).select { |x| !x.marked_for_destruction? }.map(&:contact) - tc = tech_domain_contacts.includes(:contact).select { |x| !x.marked_for_destruction? }.map(&:contact) + active_admins = admin_domain_contacts.select { |x| !x.marked_for_destruction? } + 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 ([registrant] + ac + tc).each do |x| unless x.valid?