fix n+1 problem for namespaces

This commit is contained in:
skv 2014-01-15 15:23:47 +04:00
parent 38d8d749d7
commit 2f55d0b6be
1 changed files with 1 additions and 1 deletions

View File

@ -3,7 +3,7 @@ class UsersController < ApplicationController
def show
@user = User.find_by_username!(params[:username])
@projects = @user.authorized_projects.where('projects.id in (?)', current_user.authorized_projects.map(&:id))
@projects = @user.authorized_projects.where(id: current_user.authorized_projects.pluck(:id)).includes(:namespace)
@events = @user.recent_events.where(project_id: @projects.map(&:id)).limit(20)
@title = @user.name