app/controllers/orders_controller.rb
# POST orders/:product_id
# Function to add a product to cart.
POST orders/:product_id
Function to add a product to cart.
POST orders / : product_id Function to add a product to cart .
def new()
    params = new_params
    @insert_product_id = params
    @insert_product = Product.find(@insert_product_id)
    index()
  rescue => e
    flash[:alert] = "Cart adding error."
    index()
    render action: :index
  end
def new ( ) params = new_params @insert_product_id = params @insert_product = Product . find ( @insert_product_id ) index ( ) rescue => e flash [ :alert ] = "Cart adding error." index ( ) render action : :index end
POST orders/:product_id
Function to add a product to cart.
POST orders / : product_id Function to add a product to cart .
# Get data for cart info.