diff --git a/app/controllers/admin/worldwide_offices_controller.rb b/app/controllers/admin/worldwide_offices_controller.rb index 76518a78784..304a96489ff 100644 --- a/app/controllers/admin/worldwide_offices_controller.rb +++ b/app/controllers/admin/worldwide_offices_controller.rb @@ -21,8 +21,8 @@ def update update_params[:service_ids] ||= [] - if update_params.dig(:contact_attributes, :contact_numbers_attributes) - update_params.dig(:contact_attributes, :contact_numbers_attributes).each do |_id, contact_number_attribute| + 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? end end