Let's say I have a model called Theme, which has several attributes setting interface colors. Theme also has a Paperclip attachment, which is a user-generated CSS template. I want to set up a processor to generate a final CSS file, inserting the interface colors into the user-generated template. To do this, I need to access the model data from within the processor. Is this possible?
A:
The processor has an accessor called attachment
this points back to the instance of Paperclip::Attachment. The attachment in turn has an accessor instance
which points to the instance of the original model. So all you should have to do from the processor is call attachment.instance
to get the original model.
Peter Wagenet
2009-10-04 03:07:31