summaryrefslogtreecommitdiff
path: root/app/models/subscription.rb
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-03-16 15:22:50 +0200
committerValery Sizov <vsv2711@gmail.com>2015-03-16 15:22:50 +0200
commit410d25c8ca8afabb25e5f89b36e3cfd09ffe6f87 (patch)
tree8f159d92f86fbebde5a97cb7c410c85b669475ca /app/models/subscription.rb
parent0e20dc910f25db3b3f71867d54367db36334ff45 (diff)
downloadgitlab-ce-410d25c8ca8afabb25e5f89b36e3cfd09ffe6f87.tar.gz
rename table subscribe; make it polymorfic
Diffstat (limited to 'app/models/subscription.rb')
-rw-r--r--app/models/subscription.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/subscription.rb b/app/models/subscription.rb
new file mode 100644
index 00000000000..7e57a8570ec
--- /dev/null
+++ b/app/models/subscription.rb
@@ -0,0 +1,7 @@
+class Subscription < ActiveRecord::Base
+ belongs_to :subscribable, polymorphic: true
+
+ validates :user_id,
+ uniqueness: { scope: [:subscribable_id, :subscribable_type]},
+ presence: true
+end