FIX: Preload associations on subcategories when lazy loading categories (#25630)
This commit is contained in:
parent
250ce25ca3
commit
6311a80724
|
@ -159,7 +159,7 @@ class CategoryList
|
||||||
.where(parent_category_id: @categories.map { |c| c.id })
|
.where(parent_category_id: @categories.map { |c| c.id })
|
||||||
|
|
||||||
@categories +=
|
@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 <= ?)",
|
"id IN (WITH cte AS (#{categories_with_rownum.to_sql}) SELECT id FROM cte WHERE rownum <= ?)",
|
||||||
SUBCATEGORIES_PER_CATEGORY,
|
SUBCATEGORIES_PER_CATEGORY,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue