post_tags の論理削除と履歴管理を廃止 (#411) (#417)

Reviewed-on: #417
Co-authored-by: miteruzo <miteruzo@naver.com>
このコミットはプルリクエスト #417 でマージされました。
このコミットが含まれているのは:
2026-09-21 06:02:41 +09:00
committed by みてるぞ
コミット 7f0efc3a46
18個のファイルの変更388行の追加286行の削除
+3 -6
ファイルの表示
@@ -55,11 +55,10 @@ class Post < ApplicationRecord
belongs_to :uploaded_user, class_name: 'User', optional: true
has_many :post_tags, dependent: :destroy, 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 :tags, through: :active_post_tags
has_many :tags, through: :post_tags
has_many :active_tags, -> { where(tags: { deprecated_at: nil }) },
through: :active_post_tags, source: :tag
through: :post_tags,
source: :tag
has_many :user_post_views, dependent: :delete_all
has_many :post_similarities, dependent: :delete_all
@@ -123,7 +122,6 @@ class Post < ApplicationRecord
def snapshot_tag_names
post_tags
.kept
.joins(tag: :tag_name)
.includes(:sections, tag: :tag_name)
.order('tag_names.name')
@@ -150,7 +148,6 @@ class Post < ApplicationRecord
def snapshot_tags_json
post_tags
.kept
.joins(tag: :tag_name)
.includes(:sections, tag: :tag_name)
.order('tags.id')