From 1f12e41029f2531904d8600372625e360f87b8fa Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 28 Jul 2016 16:59:00 -0400 Subject: [PATCH] FIX: query for tag with no sub-categories --- app/controllers/tags_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 1033c0808ab..ad2a442ab2a 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -53,7 +53,12 @@ class TagsController < ::ApplicationController results = query.send("#{filter}_results") if @filter_on_category - category_ids = [@filter_on_category.id] + @filter_on_category.subcategories.pluck(:id) + category_ids = [@filter_on_category.id] + + unless list_opts[:no_subcategories] + category_ids += @filter_on_category.subcategories.pluck(:id) + end + results = results.where(category_id: category_ids) end