Hi!
I want to cache some fragment to place in a sidebar of my default layout, and i want to use content_for to place it.
It the API it says:
NOTE: Beware that content_for is ignored in caches. So you shouldn't use it for elements that are going to be fragment cached.
I am not really sure what means, because i have tried placing a cache block inside a content_for block and it looks that it works.
I want to know if i am using it correctly and wether it will be a problem in the future because that's not supposed to work.
In my general layout i have:
/app/views/layout/general.html.erb :
... <div id="divsidebar"> <%= yield :sidebar %> </div> ...
In mi view, i have:
/app/views/controller/index.html.erb :
... <% content_for :sidebar do %> <% cache(:action_suffix => "tagcloudcache") do %> ... <%= render(:partial => "tagcloud") %>
<% end %> <% end %> ...
My question is: Is that not supposed to work? Because it works. Is there a better way of doing it?
Thanks a lot for your attention!!
-- M