From 38efe1bf9f8758a06cfc1358cc1fae768ac0943e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Mon, 27 Mar 2017 13:58:15 +0200 Subject: Get rid of second N+1 query problem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- lib/banzai/filter/merge_request_reference_filter.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/banzai/filter/merge_request_reference_filter.rb b/lib/banzai/filter/merge_request_reference_filter.rb index 1a24525e462..faeace82ed2 100644 --- a/lib/banzai/filter/merge_request_reference_filter.rb +++ b/lib/banzai/filter/merge_request_reference_filter.rb @@ -21,6 +21,10 @@ module Banzai only_path: context[:only_path]) end + def project_from_ref(ref) + projects_per_reference[ref || current_project_path] + end + # Returns a Hash containing the merge_requests per Project instance. def merge_requests_per_project @merge_requests_per_project ||= begin -- cgit v1.2.1