carrierwaveuploader/carrierwave — pull request #1399 by jvdp (2014-06-04 23:42:41+00:00)
Title: Fix cache workfile collision between versions

After struggling with this for quite a few hours, it turns out that the changes to the cache from #1312 are not versions aware: during caching, different versions share the same workfile which gets deleted in between. Effectively, this breaks cache use for uploaders with two versions or more.

This patch ensures each version creates its own workfile. There are probably still problems if `move_to_cache` is defined as true, and perhaps this issue can also be solved by *somehow* sharing workfiles without deleting until all are done with it... The problem also does not seem to occur if the `file` storage mechanism is used, which makes it hard to add a failing test (I presume because of the state tracked by the `SanitizedFile` class, which is reused.) There's a lot of moving parts involved here...