From 792a8a2a574551af141c9de85782f1241e2ac0b9 Mon Sep 17 00:00:00 2001 From: Nils Dittberner Date: Tue, 15 Nov 2016 22:00:19 +0100 Subject: [PATCH] Iteration C5. --- app/views/store/index.html.erb | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/views/store/index.html.erb b/app/views/store/index.html.erb index 6e77806..f82b1b5 100644 --- a/app/views/store/index.html.erb +++ b/app/views/store/index.html.erb @@ -2,13 +2,17 @@

Your Pragmatic Catalog

-<% @products.each do |product| %> -
- <%= image_tag(product.image_url) %> -

<%= product.title %>

- <%= sanitize(product.description) %> -
- <%= number_to_currency(product.price) %> -
-
+<% cache @products do %> + <% @products.each do |product| %> + <% cache product do %> +
+ <%= image_tag(product.image_url) %> +

<%= product.title %>

+ <%= sanitize(product.description) %> +
+ <%= number_to_currency(product.price) %> +
+
+ <% end %> + <% end %> <% end %>