Sha256: 00587b471ddd346e15a3a096f2a77d58cc4362ca36a880944540797a4ca55f3b

Contents?: true

Size: 813 Bytes

Versions: 96

Compression:

Stored size: 813 Bytes

Contents

module Piggybak
  class CartController < ApplicationController
    def show
      @cart = Cart.new(cookies["cart"])
      @cart.update_quantities
      cookies["cart"] = { :value => @cart.to_cookie, :path => '/' }
    end
  
    def add
      cookies["cart"] = { :value => Cart.add(cookies["cart"], params), :path => '/' }
      redirect_to piggybak.cart_url
    end
  
    def remove
      response.set_cookie("cart", { :value => Cart.remove(cookies["cart"], params[:item]), :path => '/' })
      redirect_to piggybak.cart_url
    end
  
    def clear
      cookies["cart"] = { :value => '', :path => '/' }
      redirect_to piggybak.cart_url
    end
  
    def update
      cookies["cart"] = { :value => Cart.update(cookies["cart"], params), :path => '/' }
      redirect_to piggybak.cart_url
    end
  end
end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
piggybak-0.6.22 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.21 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.20 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.19 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.18 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.17 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.16 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.15 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.13 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.12 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.11 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.10 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.9 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.8 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.7 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.6 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.5 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.4 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.3 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.2 app/controllers/piggybak/cart_controller.rb