Not elegant, but I did manage to get Paperclip to stop deleting or overwriting the previous versions' attachments (I am using vestal_versions here for that part). The path I took was to patch attachment.rb and storage.rb from Paperclip. In attachment, I look to see if the instance was versioned, and if it was I would inject the version number into the filename before Paperclip saved it. In the same file, I patched the clear method to never delete an instance that was versioned.

In storage.rb, I did the reverse, and let the flush_deletes method remove a non-empty folder.

Both of these changes are fairly risky, in that they require the parent model to have a version method, which I ended up having to provide like this:

  def version
    false
  end

in anything that had a file attachment but didn't have versions. I'm pretty sure this could be improved on a lot.

Walter

On Nov 1, 2010, at 4:35 PM, CuriousNewbie wrote:

Hello. I'm hoping to hear your recommendations on using paperclip for
images with versioning.

Anyone know of any elegant paper_clip image, versioning implementation
solutions?

Thank you

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails- [email protected]. To unsubscribe from this group, send email to [email protected] . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en .


--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to