Skip to content
This repository
Newer
Older
100644 40 lines (40 sloc) 1.369 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 %>
2a9ad9cc » dhh
2008-01-03 Moved the caching stores from ActionController::Caching::Fragments::*…
34 def cache(name = {}, options = nil, &block)
c61ed70b » Carlhuda
2010-03-16 Some more tweaks on <% %>.
35 safe_concat controller.fragment_for(name, options, &block)
36 nil
df79e135 » dhh
2005-01-08 Added first stab at page and fragment caching
37 end
38 end
39 end
40 end
Something went wrong with that request. Please try again.