2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-05-18 00:54:41 +05:30
|
|
|
class Subscription < ApplicationRecord
|
2015-04-26 12:48:37 +05:30
|
|
|
belongs_to :user
|
2017-08-17 22:00:37 +05:30
|
|
|
belongs_to :project
|
2017-09-10 17:25:29 +05:30
|
|
|
belongs_to :subscribable, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
validates :user, :subscribable, presence: true
|
|
|
|
|
|
|
|
validates :project_id, uniqueness: { scope: [:subscribable_id, :subscribable_type, :user_id] }
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|