ActiveStorage variants are a black box

I expected to be able to treat variants similar to blobs, but they’re a bit of a black box and I can’t access them in the same way. I expected to be able to call byte_size, download, and other methods. After much searching, I found this Stack Overflow answer by @georgeclaghorn: ruby on rails - How to save a copy of image after using variant option in ActiveStorage. - Stack Overflow It works, but it feels like an antipattern. And there’s a lot of bad information out there on how to achieve this. I’d love to have basic file metadata available on variants.


Thanks for bringing this up! This sounds like a good new feature idea to me (although there might be issues with it that the maintainers could speak more to.)

Would you (or anyone else reading this thread) have any time to work on it? I’d be happy to support that work by helping shepherd things through The Process or brainstorming about approaches.

Have you seen/tried the new variant tracking feature in master? I suspect it’s close to what you want—it turns variants into blobs themselves. We’ll deprecate and remove old-school untracked variants in the distant future.