FIX: id is always true since it's been to_i'd

Let's only look up the category if the id has been provided
This commit is contained in:
Daniel Waterworth 2019-10-21 13:20:38 +01:00
parent 1352a5b5fa
commit 594925b896
1 changed files with 1 additions and 1 deletions

View File

@ -360,7 +360,7 @@ class ListController < ApplicationController
@category = Category.query_category(slug_or_id, parent_category_id)
# Redirect if we have `/c/:parent_category/:category/:id`
if id
if params.include?(:id)
category = Category.find_by_id(id)
(redirect_to category.url, status: 301) && return if category
end