Search code examples
ruby-on-railsfilepaperclipvestal-versions

Paperclip versioning files with vestal_versions


I have it set up right now to save Images to my rails filesystem and keep the old version of the file in a path like /images/:id/:version/:filename

How do I use vestal_versions to get the url of the old file path?

Using .revert_to!(1) increments the actual version number, so a @image.version of 2 which is then reverted to 1, becomes version 3, totally throwing a monkey wrench in my ability to get the url of the old file.

Using reset_to deletes all later revisions.

How do I do this? Do you need clarification?


Solution

  • How about just using .revert_to(1) instead of revert_to!(1) ? That way it will not perform a database update unless you choose to save it.