aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/models/active_storage/attachment.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2018-01-15 13:06:17 -0500
committerGitHub <noreply@github.com>2018-01-15 13:06:17 -0500
commitc2ba530c43244b5b60fd629f61cd8b44c43ecda9 (patch)
tree76c572f419a8e30b4ba2d2ae22570844ba28361e /activestorage/app/models/active_storage/attachment.rb
parentd8e7d6b03c50f4f01c333461c46666d8210e2c17 (diff)
downloadrails-c2ba530c43244b5b60fd629f61cd8b44c43ecda9.tar.gz
rails-c2ba530c43244b5b60fd629f61cd8b44c43ecda9.tar.bz2
rails-c2ba530c43244b5b60fd629f61cd8b44c43ecda9.zip
Extract content types from blob data
Diffstat (limited to 'activestorage/app/models/active_storage/attachment.rb')
-rw-r--r--activestorage/app/models/active_storage/attachment.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activestorage/app/models/active_storage/attachment.rb b/activestorage/app/models/active_storage/attachment.rb
index 9f61a5dbf3..19f48c57d6 100644
--- a/activestorage/app/models/active_storage/attachment.rb
+++ b/activestorage/app/models/active_storage/attachment.rb
@@ -14,7 +14,7 @@ class ActiveStorage::Attachment < ActiveRecord::Base
delegate_missing_to :blob
- after_create_commit :analyze_blob_later
+ after_create_commit :identify_blob, :analyze_blob_later
# Synchronously purges the blob (deletes it from the configured service) and destroys the attachment.
def purge
@@ -29,6 +29,10 @@ class ActiveStorage::Attachment < ActiveRecord::Base
end
private
+ def identify_blob
+ blob.identify
+ end
+
def analyze_blob_later
blob.analyze_later unless blob.analyzed?
end