BigW Consortium Gitlab

subscription.rb 325 Bytes
Newer Older
1
class Subscription < ActiveRecord::Base
Valery Sizov committed
2
  belongs_to :user
3
  belongs_to :project
4
  belongs_to :subscribable, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations
5

6
  validates :user, :subscribable, presence: true
7

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