mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
PERF: memoize to avoid N+1 query in category page
This commit is contained in:
parent
55c0f6a20c
commit
6246dd0aa2
1 changed files with 2 additions and 1 deletions
|
@ -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 a new issue