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.
This commit is contained in:
parent
8237da0d4a
commit
b5f8161dae
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue