summaryrefslogtreecommitdiff
path: root/app/models/gpg_signature.rb
diff options
context:
space:
mode:
authorRubén Dávila <ruben@gitlab.com>2017-10-05 10:17:18 -0500
committerRubén Dávila <ruben@gitlab.com>2017-10-05 10:17:18 -0500
commit5595d73763caf224df4109ab2d52e616cd843d49 (patch)
tree9de3c6d2eb1fdf0bc182fa54acc0c19ca1640802 /app/models/gpg_signature.rb
parentbd8e3606a202273129b963742aa071a0d2c8812f (diff)
downloadgitlab-ce-5595d73763caf224df4109ab2d52e616cd843d49.tar.gz
Small refactor and fix for RuboCop
Diffstat (limited to 'app/models/gpg_signature.rb')
-rw-r--r--app/models/gpg_signature.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/models/gpg_signature.rb b/app/models/gpg_signature.rb
index b718e8e1000..675e7a2456d 100644
--- a/app/models/gpg_signature.rb
+++ b/app/models/gpg_signature.rb
@@ -22,14 +22,11 @@ class GpgSignature < ActiveRecord::Base
validates :gpg_key_primary_keyid, presence: true
def self.with_key_and_subkeys(gpg_key)
- return none unless gpg_key
-
- t = arel_table
- subkey_ids = gpg_key&.subkeys&.pluck(:id)
+ subkey_ids = gpg_key.subkeys.pluck(:id)
where(
- t[:gpg_key_id].eq(gpg_key&.id).or(
- t[:gpg_key_subkey_id].in(subkey_ids)
+ arel_table[:gpg_key_id].eq(gpg_key.id).or(
+ arel_table[:gpg_key_subkey_id].in(subkey_ids)
)
)
end