提交 333ecdcb 编写于 作者: G Gourav Tiwari

Better formatted documents [ci skip]

上级 9c290fbe
...@@ -75,7 +75,8 @@ module CacheHelper ...@@ -75,7 +75,8 @@ module CacheHelper
# render(topics) => render("topics/topic") # render(topics) => render("topics/topic")
# render(message.topics) => render("topics/topic") # render(message.topics) => render("topics/topic")
# #
# It's not possible to derive all render calls like that, though. Here are a few examples of things that can't be derived: # It's not possible to derive all render calls like that, though.
# Here are a few examples of things that can't be derived:
# #
# render group_of_attachments # render group_of_attachments
# render @project.documents.where(published: true).order('created_at') # render @project.documents.where(published: true).order('created_at')
...@@ -97,19 +98,21 @@ module CacheHelper ...@@ -97,19 +98,21 @@ module CacheHelper
# <%# Template Dependency: todolists/todolist %> # <%# Template Dependency: todolists/todolist %>
# <%= render_sortable_todolists @project.todolists %> # <%= render_sortable_todolists @project.todolists %>
# #
# The pattern used to match these is /# Template Dependency: ([^ ]+)/, so it's important that you type it out just so. # The pattern used to match these is /# Template Dependency: ([^ ]+)/,
# so it's important that you type it out just so.
# You can only declare one template dependency per line. # You can only declare one template dependency per line.
# #
# === External dependencies # === External dependencies
# #
# If you use a helper method, for example, inside of a cached block and you then update that helper, # If you use a helper method, for example, inside a cached block and
# you'll have to bump the cache as well. It doesn't really matter how you do it, but the md5 of the template file # you then update that helper, you'll have to bump the cache as well.
# It doesn't really matter how you do it, but the md5 of the template file
# must change. One recommendation is to simply be explicit in a comment, like: # must change. One recommendation is to simply be explicit in a comment, like:
# #
# <%# Helper Dependency Updated: May 6, 2012 at 6pm %> # <%# Helper Dependency Updated: May 6, 2012 at 6pm %>
# <%= some_helper_method(person) %> # <%= some_helper_method(person) %>
# #
# Now all you'll have to do is change that timestamp when the helper method changes. # Now all you have to do is change that timestamp when the helper method changes.
# #
# === Automatic Collection Caching # === Automatic Collection Caching
# #
...@@ -118,7 +121,7 @@ module CacheHelper ...@@ -118,7 +121,7 @@ module CacheHelper
# <%= render @notifications %> # <%= render @notifications %>
# <%= render partial: 'notifications/notification', collection: @notifications %> # <%= render partial: 'notifications/notification', collection: @notifications %>
# #
# If the notifications/_notification partial starts with a cache call like so: # If the notifications/_notification partial starts with a cache call as:
# #
# <% cache notification do %> # <% cache notification do %>
# <%= notification.name %> # <%= notification.name %>
...@@ -127,8 +130,9 @@ module CacheHelper ...@@ -127,8 +130,9 @@ module CacheHelper
# The collection can then automatically use any cached renders for that # The collection can then automatically use any cached renders for that
# template by reading them at once instead of one by one. # template by reading them at once instead of one by one.
# #
# See ActionView::Template::Handlers::ERB.resource_cache_call_pattern for more # See ActionView::Template::Handlers::ERB.resource_cache_call_pattern for
# information on what cache calls make a template eligible for this collection caching. # more information on what cache calls make a template eligible for this
# collection caching.
# #
# The automatic cache multi read can be turned off like so: # The automatic cache multi read can be turned off like so:
# #
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册