summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-07-08 06:22:09 +0000
committerStan Hu <stanhu@gmail.com>2017-07-08 06:22:09 +0000
commit43b9141c365930326d50c8c8566d67722172d2ec (patch)
tree6eeaa5c2bfd75800840bf40c59d18522a631020b /app/models
parent42481d1b437f9502dc776b1ba7cb1276d5e4e984 (diff)
parentb963d45ca4bd883556be5d410feac995f9b50b81 (diff)
downloadgitlab-ce-43b9141c365930326d50c8c8566d67722172d2ec.tar.gz
Merge branch 'sh-optimize-mr-api' into 'master'
Remove many N+1 queries with merge requests API See merge request !12726
Diffstat (limited to 'app/models')
-rw-r--r--app/models/merge_request.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 30caa3598d1..815c5b43406 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -15,7 +15,7 @@ class MergeRequest < ActiveRecord::Base
has_many :merge_request_diffs
has_one :merge_request_diff,
- -> { order('merge_request_diffs.id DESC') }
+ -> { order('merge_request_diffs.id DESC') }, inverse_of: :merge_request
belongs_to :head_pipeline, foreign_key: "head_pipeline_id", class_name: "Ci::Pipeline"