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

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