Commit 69e73b0f authored by Toon Claes's avatar Toon Claes

Add #resource_parent to Snippet

In a future commit we will be calling #resource_parent on an object we
don't know the exact type of. But all of them respond to that method,
except for Snippet. With this change we can safely call it without
getting a NoMethodError.
parent 853408a1
......@@ -40,6 +40,7 @@ class Snippet < ApplicationRecord
belongs_to :author, class_name: 'User'
belongs_to :project
alias_method :resource_parent, :project
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment