Commit d20f7d28 by Bart de Water

Update example for adding mime-types to not use deprecated functionality. Fixes #1737.

The old example gives deprecation warnings from recent 2.x versions of mime-types. As of f0bd25ad the Gemfile also allows version 3.0 or newer. The new example should work regardless of the version of the mime-types gem. [skip ci]
parent c38bb316
...@@ -445,14 +445,13 @@ will not cause errors to be raised. ...@@ -445,14 +445,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