Class: Piggybak::CartController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Piggybak::CartController
- Defined in:
- app/controllers/piggybak/cart_controller.rb
Instance Method Summary collapse
Instance Method Details
#add ⇒ Object
9 10 11 12 |
# File 'app/controllers/piggybak/cart_controller.rb', line 9 def add ["cart"] = { :value => Cart.add(["cart"], params), :path => '/' } redirect_to piggybak.cart_url end |
#clear ⇒ Object
19 20 21 22 |
# File 'app/controllers/piggybak/cart_controller.rb', line 19 def clear ["cart"] = { :value => '', :path => '/' } redirect_to piggybak.cart_url end |
#remove ⇒ Object
14 15 16 17 |
# File 'app/controllers/piggybak/cart_controller.rb', line 14 def remove response.("cart", { :value => Cart.remove(["cart"], params[:item]), :path => '/' }) redirect_to piggybak.cart_url end |
#show ⇒ Object
3 4 5 6 7 |
# File 'app/controllers/piggybak/cart_controller.rb', line 3 def show @cart = Cart.new(["cart"]) @cart.update_quantities ["cart"] = { :value => @cart., :path => '/' } end |
#update ⇒ Object
24 25 26 27 |
# File 'app/controllers/piggybak/cart_controller.rb', line 24 def update ["cart"] = { :value => Cart.update(["cart"], params), :path => '/' } redirect_to piggybak.cart_url end |