From c900c21eef9235306d7d0da42b07aa2de346e263 Mon Sep 17 00:00:00 2001 From: "micael.bergeron" <micaelbergeron@gmail.com> Date: Tue, 21 Nov 2017 08:31:23 -0500 Subject: add `#with_metadata` scope to remove a N+1 from the notes' API --- app/models/note.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/models/note.rb') diff --git a/app/models/note.rb b/app/models/note.rb index 4bbb54ba9bf..50c9caf8529 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -110,6 +110,7 @@ class Note < ActiveRecord::Base includes(:author, :noteable, :updated_by, project: [:project_members, { group: [:group_members] }]) end + scope :with_metadata, -> { includes(:system_note_metadata) } after_initialize :ensure_discussion_id before_validation :nullify_blank_type, :nullify_blank_line_code -- cgit v1.2.1