Update service metadata for updated Blobs only

Follow-up to #40013.

Newly created `Blob`s may not be uploaded yet, so do not try to update
their service metadata.
This commit is contained in:
Jonathan Hefner 2020-08-13 09:45:46 -05:00 committed by GitHub
parent b68eea3795
commit 601006c56d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ class ActiveStorage::Blob < ActiveRecord::Base
self.service_name ||= self.class.service.name
end
after_commit :update_service_metadata, if: :content_type_previously_changed?
after_update_commit :update_service_metadata, if: :content_type_previously_changed?
before_destroy(prepend: true) do
raise ActiveRecord::InvalidForeignKey if attachments.exists?