I started using Carrierwave, and I found out that it stores temporary files at multiple places depending on whether it is testing or delayed job.
If it is done during testing(rspec), the temp files will be at RAILS_ROOT/uploads/tmp
directory.
If it is done during delayed job, the temp files will be at RAILS_ROOT/public/uploads/tmp
First, I was thinking that rails_root/tmp/uploads
would be a more sensible place, or even the system temporary folder.
Second, the testing being different to normal run seems like a bug.
Is there a way to fix this (either by configuration or monkey patching)? And can I put things in the RAILS_ROOT/tmp folder?
There is config.cache_dir
option you can set in 'config/initializers/carrierwave.rb'. But it is relative to '/public'. Looks like you should do that in your uploaders:
class MyUploader < CarrierWave::Uploader::Base
def cache_dir
# should return path to cache dir
Rails.root.join 'tmp/uploads'
end
end