small medium large xlarge


Here is my solution I was kinda hoping to get it to redirect to the cart but I didn’t get it working as I wanted and ended up redirecting back to the catalog and leaving a notice


<div class="cart_title">Your Cart</div>
  <% for item in @cart.line_items %>
      <td><%= item.quantity %>&times;</td>
      <td><%= item.product.title %></td>
      <td class="item_price"><%= number_to_currency(item.total_price) %></td>
      <td><%= button_to 'Delete Line Item', item, :method => :delete, :confirm => 'Are You Sure' %></td>

  <% end %>

  <tr class="total_line">
    <td colspan="2">Total</td>
    <td class="total_cell"><%= number_to_currency(@cart.total_price) %></td>


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


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

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

Page History
  • V32: Nish Lalgee [5 months ago]
  • V31: Nish Lalgee [5 months ago]
  • V47: Alexander Bradley [about 6 years ago]
  • V31: lulalala [almost 7 years ago]
  • V30: lulalala [almost 7 years ago]
  • V29: Christopher Paul [almost 7 years ago]
  • V28: Christopher Paul [almost 7 years ago]
  • V27: ubique [about 7 years ago]
  • V26: ubique [about 7 years ago]
  • V25: ubique [about 7 years ago]