feat: 投稿とタグのリレーション・テーブルについて論理削除と履歴を追加(#84) #148

Merged
みてるぞ merged 5 commits from feature/084 into main 2025-12-13 16:34:47 +09:00
Showing only changes of commit 851eb04e14 - Show all commits
+1 -1
View File
@@ -4,7 +4,7 @@ class Post < ApplicationRecord
belongs_to :parent, class_name: 'Post', optional: true, foreign_key: 'parent_id' belongs_to :parent, class_name: 'Post', optional: true, foreign_key: 'parent_id'
belongs_to :uploaded_user, class_name: 'User', optional: true belongs_to :uploaded_user, class_name: 'User', optional: true
has_many :post_tags, dependent: :delete_all, inverse_of: :post has_many :post_tags, dependent: :destroy, inverse_of: :post
has_many :active_post_tags, -> { kept }, class_name: 'PostTag', inverse_of: :post has_many :active_post_tags, -> { kept }, class_name: 'PostTag', inverse_of: :post
has_many :post_tags_with_discarded, -> { with_discarded }, class_name: 'PostTag' has_many :post_tags_with_discarded, -> { with_discarded }, class_name: 'PostTag'
has_many :tags, through: :active_post_tags has_many :tags, through: :active_post_tags