paperclip

https://github.com/thoughtbot/paperclip

Ruby

Easy file attachment management for ActiveRecord

Paperclip::Interpolations#content_type_extension

Returns an extension based on the content type. e.g. "jpeg" for
"image/jpeg". If the style has a specified format, it will override the
content-type detection.

Each mime type generally has multiple extensions associated with it, so
if the extension from the original filename is one of these extensions,
that extension is used, otherwise, the first in the list is used.

Source | Google | Stack overflow

Edit

git clone [email protected]:thoughtbot/paperclip.git

cd paperclip

open lib/paperclip/interpolations.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Paperclip--Interpolations-content_type_extension-for-pr


# Commit to git

git add lib/paperclip/interpolations.rbgit commit -m "better docs for Paperclip::Interpolations#content_type_extension"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Paperclip--Interpolations-content_type_extension-for-pr

hub pull-request


# Celebrate!