diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-02-20 16:12:56 +0300 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2018-02-20 20:07:40 +0300 |
commit | a10d09ec655d37d22c4ec5cadadaa1bdb6cd2f32 (patch) | |
tree | 50a123aae4c5fa8fc7d2b55484c136d9653fd406 /app | |
parent | 3eaf8778981a6563809f59aa748fe3bdeace9702 (diff) |
Fix N+1 query problem for users on members view.
For each member being rendered on
Projects::ProjectMembersController#index, there was a query to the users
table to retrieve the corresponding user:
```
SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1
```
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/members_finder.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/finders/members_finder.rb b/app/finders/members_finder.rb index 271d846b269..092c2b3b71e 100644 --- a/app/finders/members_finder.rb +++ b/app/finders/members_finder.rb @@ -19,7 +19,7 @@ class MembersFinder sql = distinct_on(union) - Member.from("(#{sql}) AS #{Member.table_name}") + Member.includes(:user).from("(#{sql}) AS #{Member.table_name}") else project_members end |