mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
PERF: memoize to avoid N+1 query in category page
This commit is contained in:
parent
55c0f6a20c
commit
6246dd0aa2
@ -382,7 +382,8 @@ SQL
|
||||
end
|
||||
|
||||
def has_children?
|
||||
id && Category.where(parent_category_id: id).exists?
|
||||
@has_children ||= (id && Category.where(parent_category_id: id).exists?) ? :true : :false
|
||||
@has_children == :true
|
||||
end
|
||||
|
||||
def uncategorized?
|
||||
|
Loading…
Reference in New Issue
Block a user