3
# This helper to exposes a method for caching of view fragments.
4
# See ActionController::Caching::Fragments for usage instructions.
6
# A method for caching fragments of a view rather than an entire
7
# action or page. This technique is useful caching pieces like
8
# menus, lists of news topics, static HTML fragments, and so on.
9
# This method takes a block that contains the content you wish
10
# to cache. See ActionController::Caching::Fragments for more
14
# If you wanted to cache a navigation menu, you could do the
18
# <%= render :partial => "menu" %>
21
# You can also cache static content...
24
# <p>Hello users! Welcome to our website!</p>
27
# ...and static content mixed with RHTML content.
31
# <%= render :partial => "topics", :collection => @topic_list %>
32
# <i>Topics listed alphabetically</i>
34
def cache(name = {}, options = nil, &block)
35
@controller.fragment_for(output_buffer, name, options, &block)