I have a Rails model that has 4 Paperclip attachment types (top_graphic, intro_graphic, bg_audio, and thumbnail), each of which needs to have its file renamed according to different logic upon upload. How can I check which of the 4 attachments is currently being updated in the post-processor in order to do so?
before_post_process :file_rename
def file_rename
# e.g., if top_graphic file is being uploaded, rename file to "top_graphic.jpg"
# e.g., if intro_graphic file is being uploaded, rename file to "intro_graphic.jpg"
end
** Please note that I do know that I could create 4 new models for each of the attachment types and attach them that way. I wish to avoid doing this as it seems like unnecessary filesystem and database clutter.
Thanks.