summaryrefslogtreecommitdiff
path: root/app/models/global_milestone.rb
diff options
context:
space:
mode:
authorRubén Dávila <rdavila84@gmail.com>2016-02-23 12:15:19 -0500
committerRubén Dávila <rdavila84@gmail.com>2016-03-04 22:37:03 -0500
commite805becfe838b6ac351a15a01d58e355a0b1763b (patch)
treebc5c6a615d1cd677d5d0e1d20493d41cc2f7de62 /app/models/global_milestone.rb
parent37d92d0b7b91c678ce71393e73aa94860051fd5a (diff)
downloadgitlab-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.rb4
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