Monday, 30 September 2013

How to reload view asynchronously when carrierwave_backgrounder processing completes?

How to reload view asynchronously when carrierwave_backgrounder processing
completes?

I am using the carrierwave_backgrounder gem in a Rails 3.2 app to handle
background processing of image files and transfer to S3 via queue_classic.
The gem sets a file_processing boolean to null when processing is
complete, enabling the following:
#partial
<% if file.file_processing.nil? %>
<%= image_tag file %>
<% else %>
<p>processing</p>
<% end %>
I am using jquery to handle multiple file uploads (jquery-fileupload).
When a file upload completes, it triggers an ajax response via create.js
to render the partial.
This is fine, but means I end up with a long list of 'processing'.
Is there a callback I can take advantage of to reload the partial when
background processing is complete?

No comments:

Post a Comment