From 473b04a9f07ded15538af23f986ec618f5f8160c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= <remy@rymai.me> Date: Thu, 9 Feb 2017 12:19:55 +0100 Subject: [PATCH] Include :author, :project, and :target in Event.with_associations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable <remy@rymai.me> --- app/models/event.rb | 2 +- .../unreleased/27395-reduce-group-activity-sql-queries-2.yml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/27395-reduce-group-activity-sql-queries-2.yml diff --git a/app/models/event.rb b/app/models/event.rb index c90fee95426..57f441187b4 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -39,7 +39,7 @@ class Event < ActiveRecord::Base where(project_id: projects).recent end - scope :with_associations, -> { includes(project: :namespace) } + scope :with_associations, -> { includes(:author, :project, :target, project: :namespace) } scope :for_milestone_id, ->(milestone_id) { where(target_type: "Milestone", target_id: milestone_id) } class << self diff --git a/changelogs/unreleased/27395-reduce-group-activity-sql-queries-2.yml b/changelogs/unreleased/27395-reduce-group-activity-sql-queries-2.yml new file mode 100644 index 00000000000..f3ce1709518 --- /dev/null +++ b/changelogs/unreleased/27395-reduce-group-activity-sql-queries-2.yml @@ -0,0 +1,4 @@ +--- +title: Include :author, :project, and :target in Event.with_associations +merge_request: +author: -- 2.30.9