FIX: Handle sub-sub-category paths without an id

This commit is contained in:
Daniel Waterworth
2020-04-22 12:12:33 +01:00
parent ceee855d00
commit c8fed90e4e
3 changed files with 20 additions and 17 deletions

View File

@ -319,9 +319,7 @@ class ListController < ApplicationController
if id.present?
@category = Category.find_by_id(id)
elsif slug_path.present?
if (1..2).include?(slug_path.size)
@category = Category.find_by_slug(*slug_path.reverse)
end
@category = Category.find_by_slug_path(slug_path)
# Legacy paths
if @category.nil? && parts.last =~ /\A\d+-category/

View File

@ -359,9 +359,7 @@ class TagsController < ::ApplicationController
if id.present?
@filter_on_category = Category.find_by_id(id)
elsif slug_path.present?
if (1..2).include?(slug_path.size)
@filter_on_category = Category.find_by_slug(*slug_path.reverse)
end
@filter_on_category = Category.find_by_slug_path(slug_path)
# Legacy paths
if @filter_on_category.nil? && parts.last =~ /\A\d+-category/