Created
March 9, 2010 17:55
-
-
Save radamant/326880 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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