summaryrefslogtreecommitdiff
path: root/app/models/subscription.rb
blob: 24a2b8b51679aa02c38ea4daec05ac81cc5521d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
# frozen_string_literal: true

class Subscription < ApplicationRecord
  belongs_to :user
  belongs_to :project
  belongs_to :subscribable, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations

  validates :user, :subscribable, presence: true

  validates :project_id, uniqueness: { scope: [:subscribable_id, :subscribable_type, :user_id] }
end