diff options
| author | Yorick Peterse <yorickpeterse@gmail.com> | 2015-10-13 11:49:01 +0200 |
|---|---|---|
| committer | Yorick Peterse <yorickpeterse@gmail.com> | 2015-10-15 12:05:01 +0200 |
| commit | 1554786c6ac49b452697d2f7a3e8daf6e3ac36d3 (patch) | |
| tree | 47393db31476e5c7022350463e74a2cb6deb8ed3 /app/models/note.rb | |
| parent | ff8f7fb0a111a5db2a50aa40e967cae699b0b245 (diff) | |
| download | gitlab-ce-1554786c6ac49b452697d2f7a3e8daf6e3ac36d3.tar.gz | |
Eager load various issue/note associations
This ensures we don't end up running N+1 queries for the objects in the
affected collections.
Diffstat (limited to 'app/models/note.rb')
| -rw-r--r-- | app/models/note.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index ee0c14598f3..3ad9895a935 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -59,6 +59,7 @@ class Note < ActiveRecord::Base scope :fresh, ->{ order(created_at: :asc, id: :asc) } scope :inc_author_project, ->{ includes(:project, :author) } scope :inc_author, ->{ includes(:author) } + scope :inc_associations, ->{ includes(:author, :noteable, :updated_by) } serialize :st_diff before_create :set_diff, if: ->(n) { n.line_code.present? } |
