Skip to content

Commit

Permalink
Redirect for unpublished comics
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhbhatia committed Jan 6, 2025
1 parent 5937a9f commit 51c397a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/controllers/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
class ProductsController < ApplicationController
def show
@product = Product.find_by(slug: params[:slug])
if @product.published?
if @product.unpublished?
redirect_to root_path
flash[:error] = "The comic you're looking for, was not found"
else
@other_products = Product.published.where.not(id: @product.id).limit(4).order("RANDOM()")
set_meta_tags title: @product.name,
description: @product.description,
Expand All @@ -21,9 +24,6 @@ def show
site_name: :site,
image: @product.issue_cover
}
else
redirect_to root_path
flash[:error] = "The comic you're looking for was not found"
end
end

Expand Down

0 comments on commit 51c397a

Please sign in to comment.