diff --git a/app/controllers/tag_groups_controller.rb b/app/controllers/tag_groups_controller.rb index 050aaa423..783839fd4 100644 --- a/app/controllers/tag_groups_controller.rb +++ b/app/controllers/tag_groups_controller.rb @@ -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 diff --git a/app/serializers/tag_group_serializer.rb b/app/serializers/tag_group_serializer.rb index 560eef34b..62858aff2 100644 --- a/app/serializers/tag_group_serializer.rb +++ b/app/serializers/tag_group_serializer.rb @@ -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