summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorJarka Kadlecova <jarka@gitlab.com>2017-03-20 09:20:46 +0100
committerJarka Kadlecova <jarka@gitlab.com>2017-03-20 12:45:43 +0100
commitbf41a2e7525cc952686623b508023c169dbdfe2d (patch)
tree54c40265696352d6972989dddd21d46f7c6ed9ae /app/models
parent691402fb2b361ba19db3b8bdf77b75e513883423 (diff)
downloadgitlab-ce-bf41a2e7525cc952686623b508023c169dbdfe2d.tar.gz
Todos performance: Include associations in Finder
Diffstat (limited to 'app/models')
-rw-r--r--app/models/merge_request.rb5
1 files changed, 1 insertions, 4 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 4759829a15c..cef8ad76b07 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -7,6 +7,7 @@ class MergeRequest < ActiveRecord::Base
belongs_to :target_project, class_name: "Project"
belongs_to :source_project, class_name: "Project"
+ belongs_to :project, foreign_key: :target_project_id
belongs_to :merge_user, class_name: "User"
has_many :merge_request_diffs, dependent: :destroy
@@ -540,10 +541,6 @@ class MergeRequest < ActiveRecord::Base
target_project != source_project
end
- def project
- target_project
- end
-
# If the merge request closes any issues, save this information in the
# `MergeRequestsClosingIssues` model. This is a performance optimization.
# Calculating this information for a number of merge requests requires