diff options
author | Rémy Coutable <remy@rymai.me> | 2019-02-14 13:27:01 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-02-14 13:27:01 +0300 |
commit | 7b84ec00251438264daadb132b50284bdf35c1ff (patch) | |
tree | ece0857fe0dbe52223d8b6a998373bd167e0636a | |
parent | 8752254df958be0d720597ef672ad26da740c091 (diff) | |
parent | 08e3907b7fd0e8d602a39c0e3f3309e81fa05e82 (diff) |
Merge branch 'bvl-multiple-codeowner-approval-rules-ce' into 'master'
Add a scope to preload emails on a user
See merge request gitlab-org/gitlab-ce!25051
-rw-r--r-- | app/models/user.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 24101eda0b1..0d52006db28 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -275,6 +275,7 @@ class User < ApplicationRecord scope :confirmed, -> { where.not(confirmed_at: nil) } scope :by_username, -> (usernames) { iwhere(username: Array(usernames).map(&:to_s)) } scope :for_todos, -> (todos) { where(id: todos.select(:user_id)) } + scope :with_emails, -> { preload(:emails) } # Limits the users to those that have TODOs, optionally in the given state. # |