summaryrefslogtreecommitdiff
path: root/app/models/note_diff_file.rb
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2018-05-16 12:46:18 -0300
committerOswaldo Ferreira <oswaldo@gitlab.com>2018-05-24 15:34:43 -0300
commitbb8f2520b4254c9dabe377df48e29c5f17894a1d (patch)
tree59c0f074d6c662fd6243219e2cdfb205000e59f2 /app/models/note_diff_file.rb
parentddc760a0d625706196629c061f9dfa1cd2d8402e (diff)
downloadgitlab-ce-bb8f2520b4254c9dabe377df48e29c5f17894a1d.tar.gz
Persist truncated note diffs on a new table45190-create-notes-diff-files
We request Gitaly in a N+1 manner to build discussion diffs. Once the diffs are from different revisions, it's hard to make a single request to the service in order to build the whole response. With this change we solve this problem and simplify a lot fetching this piece of info.
Diffstat (limited to 'app/models/note_diff_file.rb')
-rw-r--r--app/models/note_diff_file.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/note_diff_file.rb b/app/models/note_diff_file.rb
new file mode 100644
index 00000000000..e688018a6d9
--- /dev/null
+++ b/app/models/note_diff_file.rb
@@ -0,0 +1,7 @@
+class NoteDiffFile < ActiveRecord::Base
+ include DiffFile
+
+ belongs_to :diff_note, inverse_of: :note_diff_file
+
+ validates :diff_note, presence: true
+end