aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRyan Davidson <daviryan@aol.com>2018-05-06 16:25:05 +0100
committerRyan Davidson <daviryan@aol.com>2018-05-08 23:01:57 +0100
commit8e98bb7758f081622ab5c4eebf3730cce22ee627 (patch)
tree005431e48933ba96e655a56fabd436bcba442c1a /guides
parent5c7656d9a568fda855e6e558b7e44b1ba51425be (diff)
downloadrails-8e98bb7758f081622ab5c4eebf3730cce22ee627.tar.gz
rails-8e98bb7758f081622ab5c4eebf3730cce22ee627.tar.bz2
rails-8e98bb7758f081622ab5c4eebf3730cce22ee627.zip
Add option to ActiveStorage::Blob to set extract_content_type_from_io
This adds a boolean argument called identify to ActiveStorage::Blob methods #create_after_upload, #build_after_upload and #upload. It allows a user to bypass the automatic content_type inference from the io.
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_storage_overview.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/guides/source/active_storage_overview.md b/guides/source/active_storage_overview.md
index 09af899074..292928488b 100644
--- a/guides/source/active_storage_overview.md
+++ b/guides/source/active_storage_overview.md
@@ -319,6 +319,18 @@ type you provide if it can’t do that.
@message.image.attach(io: File.open('/path/to/file'), filename: 'file.pdf', content_type: 'application/pdf')
```
+You can bypass the content type inference from the data by passing in
+`identify: false` along with the `content_type`.
+
+```ruby
+@message.image.attach(
+ io: File.open('/path/to/file'),
+ filename: 'file.pdf',
+ content_type: 'application/pdf'
+ identify: false
+)
+```
+
If you don’t provide a content type and Active Storage can’t determine the
file’s content type automatically, it defaults to application/octet-stream.