diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2015-10-14 12:44:10 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2015-10-15 12:05:01 +0200 |
commit | 8237da0d4a250b4cb07e85caac3c43e11e282ebb (patch) | |
tree | 9744680e5e14cbb1c4d06585f37dcc5a30451931 /app | |
parent | d4832b0341643d90df8323a5564521d3bcd3abc1 (diff) | |
download | gitlab-ce-8237da0d4a250b4cb07e85caac3c43e11e282ebb.tar.gz |
Eager load note projects when viewing issues
Diffstat (limited to 'app')
-rw-r--r-- | app/models/note.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index 3ad9895a935..d0b30c55791 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -59,7 +59,10 @@ 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) } + + scope :inc_associations, -> do + includes(:author, :noteable, :updated_by, :project) + end serialize :st_diff before_create :set_diff, if: ->(n) { n.line_code.present? } |