From 5fb2f0c07f0e30adc2b3a6d2a1fab896ee9739b8 Mon Sep 17 00:00:00 2001 From: Rizwan Reza Date: Thu, 23 Dec 2010 16:06:53 +0330 Subject: Revised documentation for cache_helper. --- actionpack/lib/action_view/helpers/cache_helper.rb | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'actionpack/lib/action_view/helpers/cache_helper.rb') diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb index f544a9d147..f41a16a61e 100644 --- a/actionpack/lib/action_view/helpers/cache_helper.rb +++ b/actionpack/lib/action_view/helpers/cache_helper.rb @@ -2,31 +2,29 @@ module ActionView # = Action View Cache Helper module Helpers module CacheHelper - # This helper to exposes a method for caching of view fragments. - # See ActionController::Caching::Fragments for usage instructions. + # This helper exposes a method for caching view fragments caching + # fragments of a view rather than an entire action or page. This + # technique is useful caching pieces like menus, lists of news + # topics, static HTML fragments, and so on. This method takes a + # block that contains the content you wish to cache. # - # A method for caching fragments of a view rather than an entire - # action or page. This technique is useful caching pieces like - # menus, lists of news topics, static HTML fragments, and so on. - # This method takes a block that contains the content you wish - # to cache. See ActionController::Caching::Fragments for more - # information. + # See ActionController::Caching::Fragments for usage instructions. # # ==== Examples - # If you wanted to cache a navigation menu, you could do the - # following. + # If you want to cache a navigation menu, you can do following: # # <% cache do %> # <%= render :partial => "menu" %> # <% end %> # - # You can also cache static content... + # You can also cache static content: # # <% cache do %> #

Hello users! Welcome to our website!

# <% end %> # - # ...and static content mixed with RHTML content. + # Static content with embedded ruby content can be cached as + # well: # # <% cache do %> # Topics: -- cgit v1.2.3 From 0997d5a12dcefe5df4089ddd8b305318abc0a9d4 Mon Sep 17 00:00:00 2001 From: Rizwan Reza Date: Thu, 23 Dec 2010 16:13:36 +0330 Subject: More minor edits. --- actionpack/lib/action_view/helpers/cache_helper.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'actionpack/lib/action_view/helpers/cache_helper.rb') diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb index f41a16a61e..30e6c078b1 100644 --- a/actionpack/lib/action_view/helpers/cache_helper.rb +++ b/actionpack/lib/action_view/helpers/cache_helper.rb @@ -2,11 +2,11 @@ module ActionView # = Action View Cache Helper module Helpers module CacheHelper - # This helper exposes a method for caching view fragments caching - # fragments of a view rather than an entire action or page. This - # technique is useful caching pieces like menus, lists of news - # topics, static HTML fragments, and so on. This method takes a - # block that contains the content you wish to cache. + # This helper exposes a method for caching fragments of a view + # rather than an entire action or page. This technique is useful + # caching pieces like menus, lists of newstopics, static HTML + # fragments, and so on. This method takes a block that contains + # the content you wish to cache. # # See ActionController::Caching::Fragments for usage instructions. # -- cgit v1.2.3 From 7dab186fded971e69f9d8bf5db524c20da326b83 Mon Sep 17 00:00:00 2001 From: Christos Trochalakis Date: Thu, 16 Sep 2010 19:44:18 +0300 Subject: Issue one Cache#read command instead of two in the case of a fragment cache hit --- actionpack/lib/action_view/helpers/cache_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view/helpers/cache_helper.rb') diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb index 30e6c078b1..385378ea29 100644 --- a/actionpack/lib/action_view/helpers/cache_helper.rb +++ b/actionpack/lib/action_view/helpers/cache_helper.rb @@ -44,8 +44,8 @@ module ActionView private # TODO: Create an object that has caching read/write on it def fragment_for(name = {}, options = nil, &block) #:nodoc: - if controller.fragment_exist?(name, options) - controller.read_fragment(name, options) + if fragment = controller.read_fragment(name, options) + fragment else # VIEW TODO: Make #capture usable outside of ERB # This dance is needed because Builder can't use capture -- cgit v1.2.3