Make sure taggable_type is 'Customer' when querying customer tags

This commit is contained in:
Matt-Yorkley
2020-04-10 20:14:14 +02:00
parent 4c41c84cc1
commit a6414b6dbe

View File

@@ -96,7 +96,10 @@ module Admin
customer_tags = ::ActsAsTaggableOn::Tag.
joins(:taggings).
includes(:taggings).
where(taggings: { taggable_id: Customer.of(managed_enterprise_id), context: 'tags' })
where(taggings:
{ taggable_type: 'Customer',
taggable_id: Customer.of(managed_enterprise_id),
context: 'tags' })
customer_tags.each_with_object({}) do |tag, indexed_hash|
customer_id = tag.taggings.first.taggable_id