diff options
author | George Claghorn <george.claghorn@gmail.com> | 2018-05-08 18:46:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-08 18:46:08 -0400 |
commit | 38ea7bb74d5c3d2ae992c35b6eb731d059aa772a (patch) | |
tree | 8be2f5c25a30ea0f1ad42a8ce74992ac5aa2cdab /guides/source/active_storage_overview.md | |
parent | 834be61e61a1ed55f056cdff12ffe4cdcaa7ca65 (diff) | |
parent | 8e98bb7758f081622ab5c4eebf3730cce22ee627 (diff) | |
download | rails-38ea7bb74d5c3d2ae992c35b6eb731d059aa772a.tar.gz rails-38ea7bb74d5c3d2ae992c35b6eb731d059aa772a.tar.bz2 rails-38ea7bb74d5c3d2ae992c35b6eb731d059aa772a.zip |
Merge pull request #32833 from ryandav/activestorage_blob_set_content_type
Add option to ActiveStorage::Blob to set extract_content_type_from_io
Diffstat (limited to 'guides/source/active_storage_overview.md')
-rw-r--r-- | guides/source/active_storage_overview.md | 12 |
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. |