jrgifford/delayed_paperclip — pull request #25 by ScotterC (2013-04-25 17:39:17+00:00)
Title: Fixing reprocess! arguments

Here's a fix for getting `reprocess!` arguments to work. Had to alias method chain the reprocess! method. Store it's argument in the delayed_options and store the old options in a class instance variable. I fear class instance variables as much as any rubyist but it works well here because by the time you get to the delayed job a normal instance variable won't be available because it's a different instance and we reset it anyway.

The other ugly part is #reprocess! is also called from the worker so I had to check the callers in the reprocess method to make sure the `process_delayed!` method wasn't in the backtrace otherwise we wouldn't be able to keep track of the options. Better ideas on how to do this would be most welcome.

The options are reset after the worker reprocesses the image. Wrote a bunch of tests to show this functionality which pass however one old test broke only in Rails 3.2 and I'd love some help with it.

The code I added to `process_delayed!` somehow messes with the paperclip callbacks only in Rails 3.2. Some how it calls the callback twice even though older versions of rails don't. For the life of me I can't figure out why.