From 4ef61b642e51c6c062bc8f5f804c3e46bcc689a2 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Wed, 22 Apr 2020 01:33:38 +0200 Subject: [PATCH] Fix disappearing tags issue --- app/controllers/admin/customers_controller.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/customers_controller.rb b/app/controllers/admin/customers_controller.rb index dac3b209dc..21942786bd 100644 --- a/app/controllers/admin/customers_controller.rb +++ b/app/controllers/admin/customers_controller.rb @@ -102,9 +102,11 @@ module Admin context: 'tags' }) customer_tags.each_with_object({}) do |tag, indexed_hash| - customer_id = tag.taggings.first.taggable_id - indexed_hash[customer_id] ||= [] - indexed_hash[customer_id] << tag.name + tag.taggings.each do |tagging| + customer_id = tagging.taggable_id + indexed_hash[customer_id] ||= [] + indexed_hash[customer_id] << tag.name + end end end end