PERF: improve perf of initial payload

also reduce  querying in topic query
This commit is contained in:
Sam
2015-09-23 13:13:34 +10:00
parent bcb070f1ca
commit a61765b9e4
3 changed files with 17 additions and 6 deletions

View File

@@ -54,8 +54,11 @@ module CategoryGuardian
# all allowed category ids
def allowed_category_ids
unrestricted = Category.where(read_restricted: false).pluck(:id)
unrestricted.concat(secure_category_ids)
@allowed_category_ids ||=
begin
unrestricted = Category.where(read_restricted: false).pluck(:id)
unrestricted.concat(secure_category_ids)
end
end
def topic_create_allowed_category_ids