FIX: query for tag with no sub-categories

This commit is contained in:
Neil Lalonde 2016-07-28 16:59:00 -04:00
parent 82e170d6a6
commit 1f12e41029

View file

@ -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