PERF: Remove eager load.

This commit is contained in:
Guo Xiang Tan 2016-11-25 11:21:08 +08:00
parent fbc3fcc4af
commit 712ff01f38
1 changed files with 1 additions and 3 deletions

View File

@ -1,9 +1,7 @@
class Admin::GroupsController < Admin::AdminController
def index
groups = Group.order(:name)
.where("id <> ?", Group::AUTO_GROUPS[:everyone])
.includes(:group_users)
groups = Group.order(:name).where("id <> ?", Group::AUTO_GROUPS[:everyone])
if search = params[:search].to_s
groups = groups.where("name ILIKE ?", "%#{search}%")