update all records at once using `update_all`

This commit is contained in:
Alexis Reigel 2017-07-25 21:14:14 +02:00
parent 843b1de0de
commit a5f04df8d7
1 changed files with 5 additions and 6 deletions

View File

@ -77,12 +77,11 @@ class GpgKey < ActiveRecord::Base
end end
def revoke def revoke
GpgSignature.where(gpg_key: self, valid_signature: true).find_each do |gpg_signature| GpgSignature.where(gpg_key: self, valid_signature: true).update_all(
gpg_signature.update_attributes!( gpg_key_id: nil,
gpg_key: nil, valid_signature: false,
valid_signature: false updated_at: Time.zone.now
) )
end
destroy destroy
end end