carrierwave_backgrounder
carrierwave_backgrounder copied to clipboard
Conditional Backgrounding
I am using Carrierwave for two file uploads within a model. The user must upload one of the two (either an image or a video) but not both. A background job is enqueued for both files even though the user is uploading one of the two. The job for the file which was not actually uploaded fails with the following message:
Errno::ENOENT: No such file or directory - ...
Meaning, if the user uploads an image, the video uploader will start and fail even though a video was not submitted. How do I prevent backgrounder from backgrounding optional file fields? I am currently using process_in_background for both files.
mount_uploader :image, ImageUploader
mount_uploader :video, VideoUploader
process_in_background :image
process_in_background :video
Thanks for the help!