Using one carrierwave image uploader with dynamic versions
Posted by Geremia Taglialatela
on 22 March 2014
I was looking for a cleaner approach to manage models with different image versions. I came into this awesome blog post by Andrea Pavoni. I needed multiple, configurable processes so I extended and updated his excellent work.
Update! November, 1st 2014
Improved the code with an initializer. This fixes an edge case with Rails Admin (versions are not created when validations fails). Now we will not pollute models with image versions and we can use the same versions for multiple models but there is a little bit of separation as a drawback.
We also improved the image uploader in order to provide progressive jpegs.
image_versions_.rb (initializer)
slideshow_image.rb
image_uploader.rb
Suggestions to improve this are always appreciated!