diff --git a/app/models/business_registry_cache.rb b/app/models/business_registry_cache.rb index 9bc65d599..18555b1a5 100644 --- a/app/models/business_registry_cache.rb +++ b/app/models/business_registry_cache.rb @@ -39,7 +39,11 @@ class BusinessRegistryCache < ActiveRecord::Base def fetch_associated_domains(ident_code, ident_cc) cached = fetch_by_ident_and_cc(ident_code, ident_cc) - cached.associated_domains unless cached.blank? + if cached.blank? + Domain.includes(:registrar, :registrant).where(contacts: {ident: ident_code, ident_country_code: ident_cc}) + else + cached.associated_domains + end end def fetch_by_ident_and_cc(ident_code, ident_cc)