Advertisement
Guest User

Untitled

a guest
Feb 25th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.41 KB | None | 0 0
  1. class ShopController < ApplicationController
  2.  
  3.     def index
  4.         #render :text => "Hello in my shop"
  5.         @categories = Category.all
  6.         @products = Product.all
  7.     end
  8.  
  9.     def product
  10.         @product = Product.find(params[:id])
  11.     end
  12.  
  13.     def category
  14.         @category = Category.find(params[:id])
  15.     end
  16.  
  17.     def to_cart
  18.         @product = Product.find(params[:id])
  19.         current_order.add_product product
  20.         redirect_to root_path
  21.     end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement