Skip to content
This repository
Newer
Older
100644 39 lines (39 sloc) 1.327 kb
df79e135 » dhh
2005-01-08 Added first stab at page and fragment caching
1 module ActionView
2 module Helpers
b00e6a98 » dhh
2007-06-23 Massive documentation update for all helpers (closes #8223, #8177, #8175
3 # This helper to exposes a method for caching of view fragments.
de5c48c4 » dhh
2005-01-10 Updated caching to include action caching as well and simplified the …
4 # See ActionController::Caching::Fragments for usage instructions.
df79e135 » dhh
2005-01-08 Added first stab at page and fragment caching
5 module CacheHelper
b00e6a98 » dhh
2007-06-23 Massive documentation update for all helpers (closes #8223, #8177, #8175
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
11 # information.
12 #
13 # ==== Examples
14 # If you wanted to cache a navigation menu, you could do the
15 # following.
16 #
17 # <% cache do %>
18 # <%= render :partial => "menu" %>
19 # <% end %>
20 #
21 # You can also cache static content...
22 #
23 # <% cache do %>
24 # <p>Hello users! Welcome to our website!</p>
25 # <% end %>
26 #
27 # ...and static content mixed with RHTML content.
28 #
29 # <% cache do %>
30 # Topics:
31 # <%= render :partial => "topics", :collection => @topic_list %>
32 # <i>Topics listed alphabetically</i>
33 # <% end %>
bbd3e396 » dhh
2005-01-20 Fixed no-binding fragment caching
34 def cache(name = {}, &block)
35 @controller.cache_erb_fragment(block, name)
df79e135 » dhh
2005-01-08 Added first stab at page and fragment caching
36 end
37 end
38 end
39 end
Something went wrong with that request. Please try again.