class Theatre < ApplicationRecord include MyDiscard has_many :comments, class_name: 'TheatreComment' has_many :theatre_watching_users, dependent: :delete_all has_many :active_theatre_watching_users, -> { active }, class_name: 'TheatreWatchingUser', inverse_of: :theatre has_many :watching_users, through: :active_theatre_watching_users, source: :user belongs_to :host_user, class_name: 'User', optional: true belongs_to :current_post, class_name: 'Post', optional: true belongs_to :created_by_user, class_name: 'User' end