summaryrefslogtreecommitdiff
path: root/app/models/subscription.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-31 15:40:27 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-11-17 15:10:12 -0200
commit4fcae04f7bb4823d740a18419f21b8d154b4ef89 (patch)
tree48bc20ed1e63a2faae77754ed602a4aa2b2e1ffe /app/models/subscription.rb
parent8762db3b8f5f45bb46de2d0fb0d8e4fd6bc04058 (diff)
downloadgitlab-ce-4fcae04f7bb4823d740a18419f21b8d154b4ef89.tar.gz
Add project_id to subscriptions
Diffstat (limited to 'app/models/subscription.rb')
-rw-r--r--app/models/subscription.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/subscription.rb b/app/models/subscription.rb
index 3b8aa1eb866..f77aec0cacf 100644
--- a/app/models/subscription.rb
+++ b/app/models/subscription.rb
@@ -1,7 +1,10 @@
class Subscription < ActiveRecord::Base
belongs_to :user
+ belongs_to :project
belongs_to :subscribable, polymorphic: true
+ validates :user, :project, :subscribable, presence: true
+
validates :user_id,
uniqueness: { scope: [:subscribable_id, :subscribable_type] },
presence: true