From 0cedd7039a882b67f1a94875f4e99de4c63b173b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 4 Jun 2014 19:20:25 +0300 Subject: Prevent a lot of sql queries for ProjectTeam#fetch_members method Signed-off-by: Dmitriy Zaporozhets --- app/models/project_team.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/project_team.rb b/app/models/project_team.rb index cc8bb60aac4..afaca374130 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -144,7 +144,10 @@ class ProjectTeam group_members = group_members.send(level) if group end - (project_members + group_members).map(&:user).uniq + user_ids = project_members.pluck(:user_id) + user_ids += group_members.pluck(:user_id) if group + + User.where(id: user_ids) end def group -- cgit v1.2.1