gitlab-org--gitlab-foss/app/models/subscription.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
355 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Subscription < ApplicationRecord
2015-03-16 09:35:48 -04:00
belongs_to :user
2016-10-31 13:40:27 -04:00
belongs_to :project
belongs_to :subscribable, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations
validates :user, :subscribable, presence: true
2016-10-31 13:40:27 -04:00
validates :project_id, uniqueness: { scope: [:subscribable_id, :subscribable_type, :user_id] }
end