Hey folks, I have a query of a has_many relation, that I want to cache. The cache_key should be invalid based on max(updated_at) but also based on max(belongs_to.updated_at).
Some code for illustration:
class Article < ApplicationRecord has_many :comments end class Comment < ApplicationRecord belongs_to :article, touch: true end
The following will work because I touch Article on every Comment update
will not get a new cache_version when article updated
I would like to propose, to
- support multiple timestamp fields in ActiveRecord::Relation.cache_version
- support table names in ActiveRecord::Relation.cache_version
What do you think?