Sha256: f19d2ba5366b5d8ea6f772ef51a9c2b5d2ea411f859e16875d59877b50425aad
Contents?: true
Size: 811 Bytes
Versions: 2
Compression:
Stored size: 811 Bytes
Contents
class CartItemsController < ApplicationController before_filter :find_cart_item, :only => [:update, :destroy] def create persist_cart if @cart.new_record? @cart.add_item(find_cartable) end def update if @cart_item.update_attributes(cart_item_params) flash[:notice] = t(:cart_updated) redirect_to cart_path(cart) else flash[:notice] = t(:cart_update_failed) end end def destroy if @cart_item.destroy flash[:notice] = t(:cart_item_removed) redirect_to cart_path(@cart) else flash[:notice] = t(:cart_update_failed) end end protected def find_cart_item @cart_item = @cart.cart_items.find(params[:id]) end private def cart_item_params params.require(:cart_item).permit! end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
carter-0.8.1 | app/controllers/cart_items_controller.rb |
carter-0.8.0 | app/controllers/cart_items_controller.rb |