summaryrefslogtreecommitdiff
path: root/app/models/snippet.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-08 09:09:17 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-08 09:09:17 +0000
commit21341457a8c422d890a9ec30838b597dea565d62 (patch)
treeaa8aca2a9bce4e16936cc8d7b40aa1c79ca82e35 /app/models/snippet.rb
parent0a319374e7784aa5c2d1c30dd832d2a0509edbab (diff)
downloadgitlab-ce-21341457a8c422d890a9ec30838b597dea565d62.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/snippet.rb')
-rw-r--r--app/models/snippet.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 5f45407c05e..eb3960ff12b 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -44,7 +44,9 @@ class Snippet < ApplicationRecord
has_many :notes, as: :noteable, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :user_mentions, class_name: "SnippetUserMention", dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
has_one :snippet_repository, inverse_of: :snippet
- has_one :statistics, class_name: 'SnippetStatistics'
+
+ # We need to add the `dependent` in order to call the after_destroy callback
+ has_one :statistics, class_name: 'SnippetStatistics', dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
delegate :name, :email, to: :author, prefix: true, allow_nil: true