From 3e42b5a291a8ac8618b349528838425e7e5e3837 Mon Sep 17 00:00:00 2001 From: Miguel Michelson Date: Sun, 21 Jul 2024 19:04:48 -0400 Subject: [PATCH] profile id --- app/controllers/products_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index a5034ae..0e24439 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -1,7 +1,7 @@ # app/controllers/products_controller.rb class ProductsController < ApplicationController before_action :authenticate_user!, except: [:index, :show] - before_action :set_product, only: [:show, :edit, :update, :destroy] + before_action :set_product, only: [:edit, :update, :destroy] before_action :authorize_user, only: [:edit, :update, :destroy] def index @@ -17,6 +17,11 @@ def index end def show + + @profile = User.find_by(username: params[:user_id]) + + @product = @profile.products.friendly.find(params[:id]) + @product_variants = @product.product_variants