subscription.rb 234 Bytes
Newer Older
1
class Subscription < ActiveRecord::Base
Valeriy's avatar
Valeriy committed
2
  belongs_to :user
3 4
  belongs_to :subscribable, polymorphic: true

5
  validates :user_id,
Valeriy's avatar
Valeriy committed
6
            uniqueness: { scope: [:subscribable_id, :subscribable_type] },
7 8
            presence: true
end