Carrierwave Fog - Need a local file? Use Cache!

If you’re like me, using carrierwave + fog to hook up your Model witih Amazon
S3, you may encounter this problem where you need to reprocess an image and you
can’t do so without downloading the file locally.

In my case, I need a to_file() method done on one of my assets but using
Carrierwave/Fog(S3) and in order for that to happen the file needs to be a
Carrierwave::SanitizedFile.

So what can I do?

  irb > MyModel.file # Carrierwave Uploader

  irb > MyModel.file
  irb = "http://whatever.s3.amazonaws.com/....."

  irb > MyModel.file.cache_stored_file!
  irb > MyModel.file.retrieve_from_cache!(MyModel.file.cache_name)

  irb > MyMobile.file
  irb = "/local/path/tmp/file ..."

Source: Carrierwave Wiki - How to: Recreate and reprocess your files stored
on
fog