Reviewed-on: #357 Co-authored-by: miteruzo <miteruzo@naver.com> Co-committed-by: miteruzo <miteruzo@naver.com>
このコミットはPull リクエスト #357 でマージされました.
このコミットが含まれているのは:
@@ -81,7 +81,7 @@ class Tag < ApplicationRecord
|
||||
|
||||
def material_id = materials.first&.id
|
||||
|
||||
def has_deerjikists = deerjikists.present?
|
||||
def has_deerjikists = deerjikists.loaded? ? deerjikists.any? : deerjikists.exists?
|
||||
|
||||
def self.tagme = find_or_create_by_tag_name!('タグ希望', category: :meta)
|
||||
def self.bot = find_or_create_by_tag_name!('bot操作', category: :meta)
|
||||
|
||||
@@ -7,6 +7,10 @@ class Theatre < ApplicationRecord
|
||||
class_name: 'TheatreWatchingUser', inverse_of: :theatre
|
||||
has_many :watching_users, through: :active_theatre_watching_users, source: :user
|
||||
|
||||
has_many :programmes, class_name: 'TheatreProgramme'
|
||||
has_many :skip_votes, class_name: 'TheatreSkipVote', dependent: :delete_all
|
||||
has_many :skip_events, class_name: 'TheatreSkipEvent', dependent: :delete_all
|
||||
|
||||
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'
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class TheatreProgramme < ApplicationRecord
|
||||
self.primary_key = :theatre_id, :position
|
||||
|
||||
belongs_to :theatre
|
||||
belongs_to :post
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
class TheatreSkipEvent < ApplicationRecord
|
||||
belongs_to :theatre
|
||||
belongs_to :post
|
||||
belongs_to :skipped_by_user, class_name: 'User'
|
||||
|
||||
has_many :voters, class_name: 'TheatreSkipEventVoter', dependent: :delete_all
|
||||
has_many :event_tags, class_name: 'TheatreSkipEventTag', dependent: :delete_all
|
||||
has_many :users, through: :voters
|
||||
has_many :tags, through: :event_tags
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
class TheatreSkipEventTag < ApplicationRecord
|
||||
self.primary_key = :theatre_skip_event_id, :tag_id
|
||||
|
||||
belongs_to :theatre_skip_event
|
||||
belongs_to :tag
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
class TheatreSkipEventVoter < ApplicationRecord
|
||||
self.primary_key = :theatre_skip_event_id, :user_id
|
||||
|
||||
belongs_to :theatre_skip_event
|
||||
belongs_to :user
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
class TheatreSkipVote < ApplicationRecord
|
||||
self.primary_key = :theatre_id, :post_id, :user_id
|
||||
|
||||
belongs_to :theatre
|
||||
belongs_to :post
|
||||
belongs_to :user
|
||||
end
|
||||
新しい課題から参照
ユーザをブロックする