Alex Wayne
Alex Wayne

Reputation: 187242

Rails - Carrier Wave Backgrounder image uploads still processing in foreground

Using Carrier Wave and Carrier Wave Backgrounder I've managed to get image processing delayed (via Delayed Job), sort of. On image upload, a job is queued, but sadly it also does the processing synchronously on upload. The scheduled job that does that same work then kicks in to process the image versions again.

Obviously, I want it to not process immediately on upload, and only process versions from the worker.

The relevant bits of my Rails 3 model are here:

class Product < ActiveRecord::Base
  include ::CarrierWave::Backgrounder::Delay
  mount_uploader :image, ProductUploader
  process_in_background :image
end

How do I force the image to not process immediately?

Upvotes: 0

Views: 1269

Answers (1)

Hugo
Hugo

Reputation: 2129

Change:

process_in_background :image

with:

store_in_background :image

Heads-up: store_in_background needs a column to write temporarily, in your case image_tmp (string) in your Product's table.

Check the Use store_in_background section from the CarrierWave_Backgrounder's readme.

This answer may be helpful too.

Upvotes: 1

Related Questions