Is there a way to tell paperclip to skip saving attachments in certain cases? I'm running some background tasks that update a model with paperclip files attached, and it re-saves those attachments after every save. Is there anyway to bypass this?
Paperclip only performs an actual save (i.e. deletes old attachment and writes new attachment) if you update the attachement, but will log [paperclip] saving attachment
every time a model is saved. It does this because the log message is printed in an after_save
call back (before it loops through all attachments and flushes any pending writes or deletes). Provided that you aren't assigning a new attachment, you can ignore the saving attachment
message.
You could use Paperclip.options[:log] = false
... (from here). Better late than never?
精彩评论