mirror of
https://github.com/gitlabhq/gitlabhq.git
synced 2025-08-15 21:22:09 +00:00
15 lines
396 B
Ruby
15 lines
396 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Subscription < ApplicationRecord
|
|
include FromUnion
|
|
include EachBatch
|
|
|
|
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
|