Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 41 lines (40 sloc) 1.369 kb
df79e13 David Heinemeier Hansson Added first stab at page and fragment caching
dhh authored
1 module ActionView
2 module Helpers
b00e6a9 David Heinemeier Hansson Massive documentation update for all helpers (closes #8223, #8177, #8175...
dhh authored
3 # This helper to exposes a method for caching of view fragments.
de5c48c David Heinemeier Hansson Updated caching to include action caching as well and simplified the nam...
dhh authored
4 # See ActionController::Caching::Fragments for usage instructions.
df79e13 David Heinemeier Hansson Added first stab at page and fragment caching
dhh authored
5 module CacheHelper
b00e6a9 David Heinemeier Hansson Massive documentation update for all helpers (closes #8223, #8177, #8175...
dhh authored
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 %>
2a9ad9c David Heinemeier Hansson Moved the caching stores from ActionController::Caching::Fragments::* to...
dhh authored
34 def cache(name = {}, options = nil, &block)
c61ed70 Some more tweaks on <% %>.
Carlhuda authored
35 safe_concat controller.fragment_for(name, options, &block)
36 nil
df79e13 David Heinemeier Hansson Added first stab at page and fragment caching
dhh authored
37 end
38 end
39 end
40 end
Something went wrong with that request. Please try again.