improve secure_category_id query

This commit is contained in:
Sam 2013-09-10 14:29:02 +10:00
parent df5f9d66e5
commit 162d94aa02

View file

@ -491,8 +491,8 @@ class User < ActiveRecord::Base
end
def secure_category_ids
cats = self.staff? ? Category.select(:id).where(read_restricted: true) : secure_categories.select('categories.id').references(:categories)
cats.map { |c| c.id }.sort
cats = self.staff? ? Category.where(read_restricted: true) : secure_categories.references(:categories)
cats.pluck('categories.id').sort
end
def topic_create_allowed_category_ids