I'd like to download an image that was uploaded to S3 using carrierwave. The image is on the Card model, mounted as an uploader. I saw this answer, but had trouble getting that solution to work. My code is:
#download image from S3
uploader = card.image #image is the mounted uploader
uploader.retrieve_from_store!(File.basename(card.image.url))
uploader.cache_stored_file!
that last line throws: "... caused an exception (undefined method `body' for nil:NilClass)..."
My carrierwave config looks like:
#config/initializers/carrierwave.rb
CarrierWave.configure do |config|
config.storage = :fog
config.cache_dir = "#{Rails.root}/tmp/upload"
...
end