diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-08-19 17:33:07 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-08-19 17:35:46 -0300 |
commit | 2067f677df69200338d8d2b78f239759fc293fee (patch) | |
tree | cf7c0f575348e3cba1fdec0b223718d8261e843a /app/models/users_star_project.rb | |
parent | 50ff074e79a67a14abdd9f5fcce8d6c7729b179f (diff) | |
download | gitlab-ce-2067f677df69200338d8d2b78f239759fc293fee.tar.gz |
Fix N+1s queries while loading users
Diffstat (limited to 'app/models/users_star_project.rb')
-rw-r--r-- | app/models/users_star_project.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/users_star_project.rb b/app/models/users_star_project.rb index 3c7a805cc5c..c633e2d8b3d 100644 --- a/app/models/users_star_project.rb +++ b/app/models/users_star_project.rb @@ -17,6 +17,7 @@ class UsersStarProject < ApplicationRecord scope :by_project, -> (project) { where(project_id: project.id) } scope :with_visible_profile, -> (user) { joins(:user).merge(User.with_visible_profile(user)) } scope :with_public_profile, -> { joins(:user).merge(User.with_public_profile) } + scope :preload_users, -> { preload(:user) } class << self def sort_by_attribute(method) |