Show.html.erb

Your Cart
<% for item in @cart.line_items %> <% end %>
<%= item.quantity %>× <%= item.product.title %> <%= number_to_currency(item.total_price) %> <%= button_to ‘Delete Line Item’, item, :method => :delete, :confirm => ‘Are You Sure’ %>
Total <%= number_to_currency(@cart.total_price) %>

<%= button_to ‘Empty cart’, @cart, :method => :delete, :confirm => ‘Are you sure?’ %>

line_items_controller.rb

def destroy @line_item = LineItem.find(params[:id]) @line_item.destroy end

respond_to do |format|
  format.html { redirect_to(store_url, :notice => 'Line Item Removed' )}
  format.xml  { head :ok }
end