Commit db5998b7 by Tute Costa

Merge pull request #2127 from bdewater/master

Update example to add mime-types to file extensions
parents cf409665 d20f7d28
...@@ -429,14 +429,13 @@ will not cause errors to be raised. ...@@ -429,14 +429,13 @@ will not cause errors to be raised.
This can sometimes cause false validation errors in applications that use custom This can sometimes cause false validation errors in applications that use custom
file extensions. In these cases you may wish to add your custom extension to the file extensions. In these cases you may wish to add your custom extension to the
list of file extensions allowed for your MIME type configured by the `mime-types` list of content type mappings by creating `config/initializers/paperclip.rb`:
gem:
```ruby ```ruby
# Allow ".foo" as an extension for files with the MIME type "text/plain". # Allow ".foo" as an extension for files with the MIME type "text/plain".
text_plain = MIME::Types["text/plain"].first Paperclip.options[:content_type_mappings] = {
text_plain.extensions << "foo" foo: %w(text/plain)
MIME::Types.index_extensions text_plain }
``` ```
--- ---
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment