Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ShopController < ApplicationController
- def index
- #render :text => "Hello in my shop"
- @categories = Category.all
- @products = Product.all
- end
- def product
- @product = Product.find(params[:id])
- end
- def category
- @category = Category.find(params[:id])
- end
- def to_cart
- @product = Product.find(params[:id])
- current_order.add_product product
- redirect_to root_path
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement