BigW Consortium Gitlab

subscription.rb 279 Bytes
Newer Older
1
class Subscription < ActiveRecord::Base
Valery Sizov committed
2
  belongs_to :user
3
  belongs_to :project
4 5
  belongs_to :subscribable, polymorphic: true

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

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