Reputation: 4429
I am using haml and Russian doll caching in rails. My goal is to cache as much static html as possible and only render dynamic content. However, I often have a large section of uncached html because there is a small bit of dynamic code in the middle.
Suppose I have this view containing 2 partials:
show.html.haml
= render 'message'
_container.html.haml
.nested
.divs
= render 'dynamic'
_dynamic.html.haml
= complex_stuff
.something
= more_complex_stuff
I cannot wrap the _container
partial in a cache block, since it contains dynamic content. I'm aware that I could key the cache block based on the dependent variables in the dynamic partial, but assume that the complexity of the dynamic partial is too high to cache.
What is a good way to solve this?
Upvotes: 0
Views: 716
Reputation: 4429
I wrote a gem to solve this problem:
https://github.com/neighborland/cache_rocket
Upvotes: -1