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?

Answers


It uses just plain old Ruby :)

Looking at their source code:

  1. Here is what version does: build_version is called to store the new version in an internal data structure.

  2. When store_versions is called later, a copy of the image is saved for each version.

  3. When using uploader.url(:thumb), it iterates over the stored versions to look for the desired image (source here)


Need Your Help

apex scheduler- what if scenarios?

salesforce apex-code scheduler

I'm looking into using apex scheduler to run a batch job. We can run it whenever we want, say 3 am when traffic is low, but I'm trying to anticipate some 'Oh-Crap' Scenarios. Can you guys help answer