You can actually use the aforementioned `includes` method with caching as well…

However, AFAIK, this will always execute the association query, whether there will be a cache hit or not.

I read somewhere that this was ok, as “Russian doll caching” goal is to save time rendering/serializing the data, more than avoiding queries to the database… And although I initially felt this was a little bit wasteful, bringing the associated data with that second query is necessary to validate/invalidate cached entries.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade