Created
March 9, 2010 17:58
-
-
Save radamant/326883 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 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