Skip to content

Commit 64bd4a0

Browse files
committed
AssignmentMixin: Tag uses eager_load
1 parent 01c5e7f commit 64bd4a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/models/mixins/assignment_mixin.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ def assignments
173173
records = kind_of?(Class) ? all : self
174174
assignment_map = records.index_by { |a| a.id }
175175
Tag
176-
.includes(:taggings).references(:taggings)
177-
.where("taggings.taggable_type = ? and tags.name like ?", name, "#{namespace}/%")
176+
.eager_load(:taggings).where(:taggings => {:taggable_type => name})
177+
.where("tags.name like ?", "#{namespace}/%")
178178
.each_with_object(Hash.new { |h, k| h[k] = [] }) do |tag, ret|
179179
tag.taggings.each do |tagging|
180180
tag_name = Tag.filter_ns([tag], namespace).first

0 commit comments

Comments
 (0)