FIX: n+1 queries in CategoryList

This commit is contained in:
Neil Lalonde 2014-02-24 15:07:38 -05:00
parent 4cd5ccdf1f
commit 46d1c8c1e0

View File

@ -54,7 +54,7 @@ class CategoryList
# Find a list of all categories to associate the topics with
def find_categories
@categories = Category
.includes(:featured_users)
.includes(:featured_users, subcategories: [:topic_only_relative_url])
.secured(@guardian)
.order('position asc')
.order('COALESCE(categories.posts_week, 0) DESC')