diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-07-25 22:14:14 +0300 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-07-27 16:46:03 +0300 |
commit | a5f04df8d76d7c3c4318820fc3053a9823143dba (patch) | |
tree | 5100425340f95773e6ce1d723b48e3d39e3cdd39 /app/models/gpg_key.rb | |
parent | 843b1de0dec3e101b323737e4d345c4e58b2a0c3 (diff) |
update all records at once using `update_all`
Diffstat (limited to 'app/models/gpg_key.rb')
-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 |