We’ve just started using paper_trail for versioning some resources, and we want to reference those in various places. I’d like to know if others have trodden this path before.
Tl;Dr
Is there an idiomatic ash way to fetch a specific guid for a version and get back hydradeted, normal ash resource struct, with version information?
(I’m going to continue researching and may self-update if I find something. Hopefully this is still a useful log for other people in the future)
More context
I’ve considered a couple of approaches and wondered if others have trodden this path before. I’m going to explain my full thinking in case it’s useful to others coming past, but you can skip to the end for my questions.
Our app is essentially a content editor, allowing users to write documents. Each document references things like images, text snippets, etc. We’ve added versioning to those resources, and now we’re updating these internal references to be version-aware.
(We use guid resource ids)
We want a document to pin e.g. “Image of a cat - v1”. Now when the CMS updates the image (e.g. updates the alt text) the document is aware that it is holding an outdated version, and should nudge the user to update the image from the CMS copy.
Idea 1 - Continue to reference the resource only
Breaking problem: we can’t pin to a specific version, so this already doesn’t work.
Idea 2 - Reference the version only
Pros: we explicitly reference version. We only need to store 1 guid.
Cons: more lookups and extra logic to get the full picture (resource with version information).
Questions: I bet there’s a clever ash way to always return resource lookups with embedded version information, but I haven’t found it yet.
3 - Create a hybrid reference, {resource, version}
Store some hybrid ID that includes both the resource and version ID.
Pros: we have both guids, we can directly work with either. More direct representation in the database (though with guids this doesn’t matter, we are planning to switch to stripe-style object ids that would have useful prefixes on ids).
Cons: we have to store both guids! Same amount of work and lookups.






















