FIX: Preload associations on subcategories when lazy loading categories (#25630)

This commit is contained in:
Daniel Waterworth
2024-02-09 11:48:26 -06:00
committed by GitHub
parent 250ce25ca3
commit 6311a80724

View File

@@ -159,7 +159,7 @@ class CategoryList
.where(parent_category_id: @categories.map { |c| c.id })
@categories +=
Category.where(
Category.includes(CategoryList.included_associations).where(
"id IN (WITH cte AS (#{categories_with_rownum.to_sql}) SELECT id FROM cte WHERE rownum <= ?)",
SUBCATEGORIES_PER_CATEGORY,
)