From f53b2033bb294520ed65cd5f45c55effecf96126 Mon Sep 17 00:00:00 2001 From: Richard Hallett Date: Wed, 25 Nov 2020 15:43:03 +0100 Subject: [PATCH] Remove client prefixes first before adding them. Part of ensuring client_prefixes is correct in index. --- app/models/client.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/client.rb b/app/models/client.rb index 558a651a0..e8f73a905 100644 --- a/app/models/client.rb +++ b/app/models/client.rb @@ -539,6 +539,9 @@ def transfer_prefixes(provider_target_id: nil) if prefix_ids.present? response = ProviderPrefix.where("prefix_id IN (?)", prefix_ids).destroy_all Rails.logger.info "[Transfer][Prefix] #{response.count} provider prefixes deleted. #{prefix_ids}" + + response = ClientPrefix.where("prefix_id IN (?)", prefix_ids).destroy_all + Rails.logger.info "[Transfer][Prefix] #{response.count} client prefixes deleted. #{prefix_ids}" end # Assign prefix(es) to provider and client