Finished chapter 9
[depot.git] / app / views / store / index.html.erb
index fff01dffcb953c92a0c8ebd97a8042ef28c58ebb..f3e7ebedff34db7d48abeaa01929ff076ef094ae 100644 (file)
@@ -2,8 +2,10 @@
 
 <% for product in @products -%>
   <div class="entry">
-    <%= link_to image_tag(product.image_url), {:action => "add_to_cart", :id => product}, :method => "post" %>
-    <h3><%= link_to h(product.title), {:action => "add_to_cart", :id => product}, :method => "post" %></h3>
+    <% form_remote_tag :url => {:action => 'add_to_cart', :id => product} do %>
+      <%= image_submit_tag(product.image_url) %>
+    <% end %>
+    <h3><%= h(product.title) %></h3>
     <%= product.description %>
     <div class="price-line">
       <span class="price"><%= number_to_currency product.price, :unit => "£" %></span>