Commit 75b8f0a5
Changed files (1)
app
controllers
app/controllers/categories_controller.rb
@@ -1,6 +1,10 @@
class CategoriesController < ApplicationController
def show
@category = Category.find_by_slug(params[:slug].downcase)
- @creations = @category.creations.includes(:user).page(params[:page]).per(12)
+ if @category
+ @creations = @category.creations.includes(:user).page(params[:page]).per(12)
+ else
+ redirect_to creation_tag_path(params[:slug].downcase), status: :moved_permanently
+ end
end
end