diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-07-25 21:14:14 +0200 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-07-27 15:46:03 +0200 |
commit | a5f04df8d76d7c3c4318820fc3053a9823143dba (patch) | |
tree | 5100425340f95773e6ce1d723b48e3d39e3cdd39 | |
parent | 843b1de0dec3e101b323737e4d345c4e58b2a0c3 (diff) | |
download | gitlab-ce-a5f04df8d76d7c3c4318820fc3053a9823143dba.tar.gz |
update all records at once using `update_all`
-rw-r--r-- | app/models/gpg_key.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/models/gpg_key.rb b/app/models/gpg_key.rb index 009a93ce1a8..535b40472b0 100644 --- a/app/models/gpg_key.rb +++ b/app/models/gpg_key.rb @@ -77,12 +77,11 @@ class GpgKey < ActiveRecord::Base end def revoke - GpgSignature.where(gpg_key: self, valid_signature: true).find_each do |gpg_signature| - gpg_signature.update_attributes!( - gpg_key: nil, - valid_signature: false - ) - end + GpgSignature.where(gpg_key: self, valid_signature: true).update_all( + gpg_key_id: nil, + valid_signature: false, + updated_at: Time.zone.now + ) destroy end |