diff options
Diffstat (limited to 'app/models/subscription.rb')
-rw-r--r-- | app/models/subscription.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/models/subscription.rb b/app/models/subscription.rb new file mode 100644 index 00000000000..dd75d3ab8ba --- /dev/null +++ b/app/models/subscription.rb @@ -0,0 +1,21 @@ +# == Schema Information +# +# Table name: subscriptions +# +# id :integer not null, primary key +# user_id :integer +# subscribable_id :integer +# subscribable_type :string(255) +# subscribed :boolean +# created_at :datetime +# updated_at :datetime +# + +class Subscription < ActiveRecord::Base + belongs_to :user + belongs_to :subscribable, polymorphic: true + + validates :user_id, + uniqueness: { scope: [:subscribable_id, :subscribable_type] }, + presence: true +end |