jstorimer / delayed_paperclip

Process your Paperclip attachments in the background with delayed_job or Resque.
https://github.com/jrgifford/delayed_paperclip/
392 stars 245 forks source link

post_process hooks don't run when attachments are processed in background #80

Closed mehulkar closed 9 years ago

mehulkar commented 9 years ago

I've added the following code to my attachment model:

class Attachment < ActiveRecord::Base
  has_attached_file :data
  before_post_process :mark_as_unprocessed
  after_post_process  :mark_as_processed
  process_in_background :data
private
  def mark_as_unprocessed
    assign_attributes(processed: false)
  end

  def mark_as_processed
    assign_attributes(processed: true)
  end
end

When I comment out the process_in_background directive, the attachment is successfully updated as processed: true, but when I process_in_background, it looks like the callbacks are not run. I'm not sure how to debug this.

mehulkar commented 9 years ago

The only related issue I see is this https://github.com/jstorimer/delayed_paperclip/issues/34

mehulkar commented 9 years ago

Closing this for https://github.com/jrgifford/delayed_paperclip/issues/120