BigW Consortium Gitlab

Commit b5f8161d by 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.
parent 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% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment