diff options
author | Rubén Dávila <rdavila84@gmail.com> | 2016-02-23 12:15:19 -0500 |
---|---|---|
committer | Rubén Dávila <rdavila84@gmail.com> | 2016-03-04 22:37:03 -0500 |
commit | e805becfe838b6ac351a15a01d58e355a0b1763b (patch) | |
tree | bc5c6a615d1cd677d5d0e1d20493d41cc2f7de62 /app/models/global_milestone.rb | |
parent | 37d92d0b7b91c678ce71393e73aa94860051fd5a (diff) | |
download | gitlab-ce-e805becfe838b6ac351a15a01d58e355a0b1763b.tar.gz |
Eager load Issues/MRs project for Milestone.
With this change we avoid doing N+1 queries when viewing Milestone's
Issues/MRs from a Group context.
Diffstat (limited to 'app/models/global_milestone.rb')
-rw-r--r-- | app/models/global_milestone.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/global_milestone.rb b/app/models/global_milestone.rb index e4dd90b631e..40193a6f050 100644 --- a/app/models/global_milestone.rb +++ b/app/models/global_milestone.rb @@ -76,11 +76,11 @@ class GlobalMilestone end def issues - @issues ||= Issue.of_milestones(milestones.map(&:id)) + @issues ||= Issue.of_milestones(milestones.map(&:id)).includes(:project) end def merge_requests - @merge_requests ||= MergeRequest.of_milestones(milestones.map(&:id)) + @merge_requests ||= MergeRequest.of_milestones(milestones.map(&:id)).includes(:target_project) end def participants |