From 92fe82c136192492291fdc247a7a88cd96d0befb Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 19 May 2015 17:25:07 +0500 Subject: [PATCH] #247 optimize a issues/pull request page --- app/controllers/home_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 170a4b48a..c1ed6c3ff 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -39,8 +39,8 @@ class HomeController < ApplicationController def issues @created_issues = current_user.issues @assigned_issues = Issue.where(assignee_id: current_user.id) - pr_ids = ProjectPolicy::Scope.new(current_user, Project).membered.uniq.pluck(:id) - @all_issues = Issue.where(project_id: pr_ids) + @all_issues = ProjectPolicy::Scope.new(current_user, Issue).membered.uniq.joins(:project) + @created_issues, @assigned_issues, @all_issues = if action_name == 'issues' [@created_issues.without_pull_requests,