mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
11644fd0ce
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 %> ```
3 lines
No EOL
76 B
Text
3 lines
No EOL
76 B
Text
<% cache customer do %>
|
|
<%= customer.name %>, <%= customer.id %>
|
|
<% end %> |