1 <h1>Listing orders</h1>
12 <% for order in @orders %>
14 <td><%=h order.name %></td>
15 <td><%=h order.address %></td>
16 <td><%=h order.email %></td>
17 <td><%=h order.pay_type %></td>
18 <td><%= number_to_currency (order.line_items.inject(0) {|sum,item| sum + item.total_price}), :unit => "£" %></td>
19 <td><%= link_to 'Show', order %></td>
20 <td><%= link_to 'Edit', edit_order_path(order) %></td>
21 <td><%= link_to 'Destroy', order, :confirm => 'Are you sure?', :method => :delete %></td>
23 <% for li in order.line_items %>
26 <td colspan="3"><i><%= li.quantity%> ×
27 <%= h li.product.title %> =
28 <%= number_to_currency li.total_price, :unit => "£" %>
38 <%= link_to 'New order', new_order_path %>