Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class StoreController < ApplicationController
- def index
- @products = Product.find_products_for_sale
- end
- def add_to_cart
- @cart = find_cart
- product = Product.find(params[:id])
- @cart.add_product(product)
- end
- #Things after this are all private
- private
- def find_cart
- session[:cart] ||= Cart.new
- end
- end
Add Comment
Please, Sign In to add comment