Where is the code for partial hashes?

There is intelligence in the partial caching for rails that watches for the partial contents to change, presumably with a hash. That is also seemingly smart enough to watch the hashes of partials rendered within the current partial too.

I can’t find the code for that in the Rails repo for the life of me. Does anyone know where that code lives?

There’s a lot of places to look in the API documentation. One method that may turn up some results is cache_key. ActiveRecord::Integration

That’s a great place to start, and then there are further refinements to it, and that method gets used all over the place.


That is ActiveRecord, not the ActionView partials part.

The core issue is sort of what your comment raises - there is a lot of caching code, and most is unrelated to partials, and it is hard to hunt down that portion.

Someone sent me a note elsewhere with the info but posting here for posterity: rails/actionview/lib/action_view/helpers/cache_helper.rb at main · rails/rails · GitHub