carrierwave

https://github.com/carrierwaveuploader/carrierwave

Ruby

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

CarrierWave::Uploader::Cache#cache!

Caches the given file. Calls process! to trigger any process callbacks.

By default, cache!() uses copy_to(), which operates by copying the file
to the cache, then deleting the original file.  If move_to_cache() is
overriden to return true, then cache!() uses move_to(), which simply
moves the file to the cache.  Useful for large files.

=== Parameters

[new_file (File, IOString, Tempfile)] any kind of file object

=== Raises

[CarrierWave::FormNotMultipart] if the assigned parameter is a string

Source | Google | Stack overflow

Edit

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

cd carrierwave

open lib/carrierwave/uploader/cache.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-CarrierWave--Uploader--Cache-cache--for-pr


# Commit to git

git add lib/carrierwave/uploader/cache.rbgit commit -m "better docs for CarrierWave::Uploader::Cache#cache!"


# 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--Cache-cache--for-pr

hub pull-request


# Celebrate!