Skip to content

Instantly share code, notes, and snippets.

@radamant
Created March 9, 2010 17:58
Show Gist options
  • Select an option

  • Save radamant/326883 to your computer and use it in GitHub Desktop.

Select an option

Save radamant/326883 to your computer and use it in GitHub Desktop.
class DelayedPaperclipJob < Struct.new(:instance_klass, :instance_id, :attachment_name)
def perform
instance = instance_klass.constantize.find(instance_id)
instance.send("#{attachment_name}_processing!", :save => true)
begin
instance.send(attachment_name).reprocess!
instance.send("#{attachment_name}_processed!")
rescue Exception => e
instance.send("#{attachment_name}_processing!", :save => true)
# DJ will now pickup this error and do its error handling
raise(e)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment