提交 b5f8161d 编写于 作者: Y Yorick Peterse

Eager load project associations for notes

This ensures that when viewing an issue each note already has the
associated project, project members, group and group members available.
Since this information is requres for every note this results in quite
the reduction of SQL queries being executed.
上级 8237da0d
......@@ -61,7 +61,8 @@ class Note < ActiveRecord::Base
scope :inc_author, ->{ includes(:author) }
scope :inc_associations, -> do
includes(:author, :noteable, :updated_by, :project)
includes(:author, :noteable, :updated_by,
project: [:project_members, {group: [:group_members]}])
end
serialize :st_diff
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册