mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
PERF: tag groups index query
This commit is contained in:
parent
4d27d7e1d3
commit
a74606c87c
2 changed files with 2 additions and 2 deletions
|
@ -4,7 +4,7 @@ class TagGroupsController < ApplicationController
|
|||
before_filter :fetch_tag_group, only: [:show, :update, :destroy]
|
||||
|
||||
def index
|
||||
tag_groups = TagGroup.order('name ASC').includes(:parent_tag).all
|
||||
tag_groups = TagGroup.order('name ASC').includes(:parent_tag).preload(:tags).all
|
||||
serializer = ActiveModel::ArraySerializer.new(tag_groups, each_serializer: TagGroupSerializer, root: 'tag_groups')
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
|
|
|
@ -2,7 +2,7 @@ class TagGroupSerializer < ApplicationSerializer
|
|||
attributes :id, :name, :tag_names, :parent_tag_name, :one_per_topic
|
||||
|
||||
def tag_names
|
||||
object.tags.pluck(:name).sort
|
||||
object.tags.map(&:name).sort
|
||||
end
|
||||
|
||||
def parent_tag_name
|
||||
|
|
Loading…
Reference in a new issue