How does Carrierwave store references to multiple versions?
How does Carrierwave store different image versions without me having to create extra rows in my database? For example, Carrierwave allows me to have multiple versions of one image (i.e. small_img, medium_img, large_img, etc). How does it do this without storing a reference to it in my database?
It uses just plain old Ruby :)
Looking at their source code:
Here is what version does: build_version is called to store the new version in an internal data structure.
When store_versions is called later, a copy of the image is saved for each version.
When using uploader.url(:thumb), it iterates over the stored versions to look for the desired image (source here)