summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2019-02-08 18:28:21 +0100
committerBob Van Landuyt <bob@vanlanduyt.co>2019-02-08 18:28:21 +0100
commit08e3907b7fd0e8d602a39c0e3f3309e81fa05e82 (patch)
tree581cda50c43640a035d25ecdc35ba2964d68f078
parent7fa7f03e77609e01e7c280ec627908ebc21fd8bc (diff)
downloadgitlab-ce-08e3907b7fd0e8d602a39c0e3f3309e81fa05e82.tar.gz
Add a scope to preload emails on a user
-rw-r--r--app/models/user.rb1
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.
#