FIX: Preload user-specific category fields (#25663)

This is used when lazy_load_categories is enabled to fetch more info
about the category.
This commit is contained in:
Bianca Nenciu
2024-02-13 20:00:44 +02:00
committed by GitHub
parent 1f50e7e38f
commit 9a6406d4bb
2 changed files with 17 additions and 1 deletions

View File

@@ -240,7 +240,11 @@ class Category < ActiveRecord::Base
# Categories with children
with_children =
Category.where(parent_category_id: category_ids).pluck(:parent_category_id).to_set
Category
.secured(@guardian)
.where(parent_category_id: category_ids)
.pluck(:parent_category_id)
.to_set
# Update category attributes
categories.each do |category|