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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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- > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks Walter, I appreciate the quick reply... To your points, would highly like to avoid messing with paperclip or vestal_versions. What about creating a customer model to store photo versions like PHOTO_VERSIONS And then on any update, manually copy the previous photo record over to PHOTO_VERSIONS? Only thing I''m not sure about is paperclip would still delete the photo from S3, so I''d have to recreate the photo? idk, it''s getting messy. Thoughts anyone? On Nov 1, 2:19 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> 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- > > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > . > > For more options, visit this group athttp://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.