From 482ddfcd30078bd677c4273998f6f50ab636d950 Mon Sep 17 00:00:00 2001 From: Callum Knights Date: Tue, 4 Jun 2024 12:01:40 +0100 Subject: [PATCH] Change if statement for phone numbers to prevent NilClass errors --- app/controllers/admin/worldwide_offices_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/worldwide_offices_controller.rb b/app/controllers/admin/worldwide_offices_controller.rb index 304a96489ff3..7fdd1bf1f396 100644 --- a/app/controllers/admin/worldwide_offices_controller.rb +++ b/app/controllers/admin/worldwide_offices_controller.rb @@ -23,7 +23,7 @@ def update if (contact_numbers_attributes = update_params.dig(:contact_attributes, :contact_numbers_attributes)) contact_numbers_attributes.each do |_id, contact_number_attribute| - contact_number_attribute[:_destroy] = true if contact_number_attribute[:label].empty? && contact_number_attribute[:number].empty? + contact_number_attribute[:_destroy] = true unless contact_number_attribute[:label].present? && contact_number_attribute[:number].present? end end