2017-09-05 22:23:34 +03:00
|
|
|
class Subscription < ApplicationRecord
|
2014-07-24 21:13:03 +05:30
|
|
|
belongs_to :conference
|
|
|
|
|
belongs_to :user
|
2014-08-22 15:08:54 +02:00
|
|
|
|
2017-03-28 21:47:17 +02:00
|
|
|
has_paper_trail on: %i(create destroy), ignore: [:updated_at], meta: { conference_id: :conference_id }
|
2016-05-24 23:54:46 +05:30
|
|
|
|
2017-03-28 21:47:17 +02:00
|
|
|
validates :user_id, uniqueness: { scope: :conference_id, message: 'already subscribed!' }
|
2014-07-24 21:13:03 +05:30
|
|
|
end
|