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
This commit is contained in:
Rémy Coutable 2019-02-14 10:27:01 +00:00
commit 7b84ec0025
1 changed files with 1 additions and 0 deletions

View File

@ -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.
#