aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/fixtures/customers
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2015-02-15 22:39:04 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2015-02-21 16:06:57 +0100
commit11644fd0ceb99f3f0529323df5ad625c596b3f21 (patch)
treed81f01715fd7966d193a657cc452edd308234fb0 /actionpack/test/fixtures/customers
parente56c63542780fe2fb804636a875f95cae08ab3f4 (diff)
downloadrails-11644fd0ceb99f3f0529323df5ad625c596b3f21.tar.gz
rails-11644fd0ceb99f3f0529323df5ad625c596b3f21.tar.bz2
rails-11644fd0ceb99f3f0529323df5ad625c596b3f21.zip
Collections automatically cache and fetch partials.
Collections can take advantage of `multi_read` if they render one template and their partials begin with a cache call. The cache call must correspond to either what the collections elements are rendered as, or match the inferred name of the partial. So with a notifications/_notification.html.erb template like: ```ruby <% cache notification %> <%# ... %> <% end %> ``` A collection would be able to use `multi_read` if rendered like: ```ruby <%= render @notifications %> <%= render partial: 'notifications/notification', collection: @notifications, as: :notification %> ```
Diffstat (limited to 'actionpack/test/fixtures/customers')
-rw-r--r--actionpack/test/fixtures/customers/_commented_customer.html.erb4
-rw-r--r--actionpack/test/fixtures/customers/_customer.html.erb3
2 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/fixtures/customers/_commented_customer.html.erb b/actionpack/test/fixtures/customers/_commented_customer.html.erb
new file mode 100644
index 0000000000..d5f6e3b491
--- /dev/null
+++ b/actionpack/test/fixtures/customers/_commented_customer.html.erb
@@ -0,0 +1,4 @@
+<%# I'm a comment %>
+<% cache customer do %>
+ <%= customer.name %>, <%= customer.id %>
+<% end %> \ No newline at end of file
diff --git a/actionpack/test/fixtures/customers/_customer.html.erb b/actionpack/test/fixtures/customers/_customer.html.erb
new file mode 100644
index 0000000000..67e9f6d411
--- /dev/null
+++ b/actionpack/test/fixtures/customers/_customer.html.erb
@@ -0,0 +1,3 @@
+<% cache customer do %>
+ <%= customer.name %>, <%= customer.id %>
+<% end %> \ No newline at end of file