carrierwave

https://github.com/carrierwaveuploader/carrierwave

Ruby

Classier solution for file uploads for Rails, Sinatra and other Ruby web frameworks

CarrierWave::Uploader::Store#filename

Override this in your Uploader to change the filename.

Be careful using record ids as filenames. If the filename is stored in the database
the record id will be nil when the filename is set. Don't use record ids unless you
understand this limitation.

Do not use the version_name in the filename, as it will prevent versions from being
loaded correctly.

=== Returns

[String] a filename

Source | Google | Stack overflow

Edit

git clone [email protected]:carrierwaveuploader/carrierwave.git

cd carrierwave

open lib/carrierwave/uploader/store.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-CarrierWave--Uploader--Store-filename-for-pr


# Commit to git

git add lib/carrierwave/uploader/store.rbgit commit -m "better docs for CarrierWave::Uploader::Store#filename"


# Open pull request

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

hub fork

git push <your name> -your-name--update-docs-CarrierWave--Uploader--Store-filename-for-pr

hub pull-request


# Celebrate!