gitlab-org--gitlab-foss/app/models/subscription.rb

10 lines
279 B
Ruby
Raw Normal View History

class Subscription < ActiveRecord::Base
2015-03-16 09:35:48 -04:00
belongs_to :user
2016-10-31 13:40:27 -04:00
belongs_to :project
belongs_to :subscribable, polymorphic: true
validates :user, :subscribable, presence: true
2016-10-31 13:40:27 -04:00
validates :project_id, uniqueness: { scope: [:subscribable_id, :subscribable_type, :user_id] }
end