summaryrefslogtreecommitdiff
path: root/app/models/subscription.rb
blob: 17869c8bac28a169be67cdca2d17ff34e55f7826 (plain)
1
2
3
4
5
6
7
8
9
class Subscription < ActiveRecord::Base
  belongs_to :user
  belongs_to :project
  belongs_to :subscribable, polymorphic: true

  validates :user, :subscribable, presence: true

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