When doing HTTP caching in rails, once would use:
fresh_when etag: @user, public: true
The problem with that is that if you chance your html for the page, the cached page is no longer going to be valid. Therefor we need a way to invalidate the page/etag every time we change something.
One way to do that is to change RAILS_CACHE_ID every time you deploy as per Etag busting on deployment .However doing that will results in all etags, for all the pages getting expired for every deployment.
I would rather have a solution where I can expire individual tags, for individual pages.
I could generate my own etag with a version like this: fresh_when etag: (@user.updated_at.to_s + "V1"), public: true
But this just doesn't feel like the "Rails way". Any more elegant solutions?