aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-03-03 20:53:49 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-03-03 20:53:49 +0100
commit2ef8a0e2b87a9c4204ee49410b3a107958790b98 (patch)
tree463e63d97ac0e9e4b336e2be62f87ce93859df25 /guides
parentbbba0649f529626a076c4247047b60cfbe86d5e4 (diff)
downloadrails-2ef8a0e2b87a9c4204ee49410b3a107958790b98.tar.gz
rails-2ef8a0e2b87a9c4204ee49410b3a107958790b98.tar.bz2
rails-2ef8a0e2b87a9c4204ee49410b3a107958790b98.zip
[ci skip] Make collection caching explicit in guides.
Since f6e4814 was written we've made collection caching explicit. Thus the documentation is outdated and needs a rewrite.
Diffstat (limited to 'guides')
-rw-r--r--guides/source/caching_with_rails.md21
1 files changed, 6 insertions, 15 deletions
diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md
index f26019c72e..ebd67a4adb 100644
--- a/guides/source/caching_with_rails.md
+++ b/guides/source/caching_with_rails.md
@@ -119,25 +119,16 @@ If you want to cache a fragment under certain conditions, you can use
The `render` helper can also cache individual templates rendered for a collection.
It can even one up the previous example with `each` by reading all cache
-templates at once instead of one by one. This is done automatically if the template
-rendered by the collection includes a `cache` call. Take a collection that renders
-a `products/_product.html.erb` partial for each element:
-
-```ruby
-render products
-```
-
-If `products/_product.html.erb` starts with a `cache` call like so:
+templates at once instead of one by one. This is done by passing `cached: true` when rendering the collection:
```html+erb
-<% cache product do %>
- <%= product.name %>
-<% end %>
+<%= render partial: 'products/product', collection: @products, cached: true %>
```
-All the cached templates from previous renders will be fetched at once with much
-greater speed. There's more info on how to make your templates [eligible for
-collection caching](http://api.rubyonrails.org/classes/ActionView/Template/Handlers/ERB.html#method-i-resource_cache_call_pattern).
+All cached templates from previous renders will be fetched at once with much
+greater speed. Additionally, the templates that haven't yet been cached will be
+written to cache and multi fetched on the next render.
+
### Russian Doll Caching