gitlab-org--gitlab-foss/app/models/subscription.rb
2016-11-17 15:10:13 -02:00

9 lines
279 B
Ruby

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