Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save radamant/326880 to your computer and use it in GitHub Desktop.
class ResquePaperclipJob
@queue = :paperclip
def self.perform(instance_klass, instance_id, attachment_name)
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 Object => e
instance.send("#{attachment_name}_processing!", :save => true)
# Hand the error off to Resque
raise(e)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment