Skip to content

Commit

Permalink
profile id
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed Jul 21, 2024
1 parent f7c380b commit 3e42b5a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/controllers/products_controller.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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


Expand Down

0 comments on commit 3e42b5a

Please sign in to comment.