Ruby on rails - Disable cache from specific div inside a cached div -
in application use cache expires_in: 5.minutes cache .cached div in view (this works fine), inside .cached div can find .vote_div div.
here have:
- cache expires_in: 5.minutes .col-xs-12.cached %h4= @image.title .img-body-vote %span= @image.body // dont want cache vote div .vote_div %p= @vote_counts = link_to 'vote', vote_path as can see cache .cached , inside div, there div called .vote_div don't want cache @ (since gives wrong number @vote_counts).
how can disable cache .vote_div?
because of rails template caching mechanism, code not able cache: false or cache: true part inside - cache expires_in: 5.minutes do.
best option re-organizing view.
.col-xs-12 - cache expires_in: 5.minutes .col-xs-12.cached %h4= @image.title .img-body-vote %span= @image.body .vote_div %p= @vote_counts = link_to 'vote', vote_path
Comments
Post a Comment