FEATURE: add filter to show topics that have not been tagged

This commit is contained in:
Neil Lalonde
2016-07-20 16:21:43 -04:00
parent 8e87a727ef
commit 7c092b0fe0
7 changed files with 70 additions and 26 deletions

View File

@@ -20,6 +20,7 @@ class TopicQuery
visible
category
tags
no_tags
order
ascending
no_subcategories
@@ -465,6 +466,9 @@ class TopicQuery
else
result = result.where("tags.name in (?)", @options[:tags])
end
elsif @options[:no_tags]
# the following will do: ("topics"."id" NOT IN (SELECT DISTINCT "topic_tags"."topic_id" FROM "topic_tags"))
result = result.where.not(:id => TopicTag.select(:topic_id).uniq)
end
end