From ce05e7de0b401c397d8e8a9b93503ee898f6a73b Mon Sep 17 00:00:00 2001 From: ArtOfCode- <hello@artofcode.co.uk> Date: Wed, 1 Jul 2020 23:16:01 +0100 Subject: [PATCH] Missed a bit --- app/controllers/tags_controller.rb | 2 +- app/models/tag.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 415481277..84a2eedfe 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -72,7 +72,7 @@ class TagsController < ApplicationController @tags = if params[:q].present? @tag.children.search(params[:q]) elsif params[:hierarchical].present? - @tag_set.tags_with_paths.order(:path) + @tag.children_with_paths.order(:path) else @tag.children.order(Arel.sql('COUNT(posts.id) DESC')) end diff --git a/app/models/tag.rb b/app/models/tag.rb index 66a44621c..41cd15e30 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -3,6 +3,7 @@ class Tag < ApplicationRecord has_and_belongs_to_many :posts has_many :children, class_name: 'Tag', foreign_key: :parent_id + has_many :children_with_paths, class_name: 'TagWithPath', foreign_key: :parent_id belongs_to :tag_set belongs_to :parent, class_name: 'Tag', optional: true -- GitLab