Skip to content
Snippets Groups Projects
Commit b5f8161d authored by Yorick Peterse's avatar Yorick Peterse
Browse files

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.
parent 8237da0d
No related branches found
No related tags found
1 merge request!1578Performance improvements when viewing individual issues
Loading
Loading
@@ -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
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment