small medium large xlarge

 

Pt-E-4

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

Page History
  • V47: Alexander Bradley [over 4 years ago]
  • V31: lulalala [about 5 years ago]
  • V30: lulalala [about 5 years ago]
  • V29: Christopher Paul [about 5 years ago]
  • V28: Christopher Paul [about 5 years ago]
  • V27: ubique [over 5 years ago]
  • V26: ubique [over 5 years ago]
  • V25: ubique [over 5 years ago]
  • V24: Karen Zeller [over 5 years ago]
  • V23: Karen Zeller [over 5 years ago]