FIX: n+1 query when fetching tag groups
This commit is contained in:
parent
610d8a5cb1
commit
99e88ce39f
|
@ -4,7 +4,7 @@ class TagGroupsController < ApplicationController
|
|||
before_filter :fetch_tag_group, only: [:show, :update, :destroy]
|
||||
|
||||
def index
|
||||
tag_groups = TagGroup.order('name ASC').preload(:tags).all
|
||||
tag_groups = TagGroup.order('name ASC').includes(:parent_tag).all
|
||||
serializer = ActiveModel::ArraySerializer.new(tag_groups, each_serializer: TagGroupSerializer, root: 'tag_groups')
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
|
|
Loading…
Reference in New Issue