FIX: Prefer Category.find_by_slug over Category.find_by(slug: ...)
It handles encoded slugs properly and ignores subcategories.
This commit is contained in:
parent
e7ff6809a3
commit
0e1c5c6bba
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue