FIX: Prefer Category.find_by_slug over Category.find_by(slug: ...)

It handles encoded slugs properly and ignores subcategories.
This commit is contained in:
Daniel Waterworth 2019-10-28 16:11:03 +00:00
parent e7ff6809a3
commit 0e1c5c6bba
1 changed files with 1 additions and 1 deletions

View File

@ -327,7 +327,7 @@ class CategoriesController < ApplicationController
end end
def fetch_category def fetch_category
@category = Category.find_by(slug: params[:id]) || Category.find_by(id: params[:id].to_i) @category = Category.find_by_slug(params[:id]) || Category.find_by(id: params[:id].to_i)
end end
def initialize_staff_action_logger def initialize_staff_action_logger