osem-fcy/app/models/subscription.rb

21 lines
538 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2021-02-20 09:57:27 -08:00
# == Schema Information
#
# Table name: subscriptions
#
# id :bigint not null, primary key
# created_at :datetime
# updated_at :datetime
# conference_id :integer
# user_id :integer
#
class Subscription < ApplicationRecord
belongs_to :conference
belongs_to :user
has_paper_trail on: %i(create destroy), ignore: [:updated_at], meta: { conference_id: :conference_id }
validates :user_id, uniqueness: { scope: :conference_id, message: 'already subscribed!' }
end