diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 12:07:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 12:07:48 +0300 |
commit | 5bd24a54ef4ce3a38a860eb53b66d062c2382971 (patch) | |
tree | 5f5e65571dfcb2c62c27600ee7655dec4b44c923 /app/models/key.rb | |
parent | 74673d04d25ffed35cbcf17cd42969bed0a4e705 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/key.rb')
-rw-r--r-- | app/models/key.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/key.rb b/app/models/key.rb index f66aa4fb329..e549c59b58f 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -39,6 +39,10 @@ class Key < ApplicationRecord alias_attribute :fingerprint_md5, :fingerprint + scope :preload_users, -> { preload(:user) } + scope :for_user, -> (user) { where(user: user) } + scope :order_last_used_at_desc, -> { reorder(::Gitlab::Database.nulls_last_order('last_used_at', 'DESC')) } + def self.regular_keys where(type: ['Key', nil]) end |