このコミットが含まれているのは:
2026-03-08 06:21:31 +09:00
コミット 1d01a39adb
3個のファイルの変更77行の追加4行の削除
+6 -3
ファイルの表示
@@ -150,15 +150,18 @@ class Tag < ApplicationRecord
next if st == target_tag
st.post_tags.find_each do |pt|
begin
pt.update!(tag: target_tag)
rescue ActiveRecord::RecordNotUnique
if PostTag.kept.exists?(post_id: pt.post_id, tag_id: target_tag.id)
pt.discard_by!(nil)
# discard 後の update! は禁止なので DB を直に更新
pt.update_columns(tag_id: target_tag.id)
else
pt.update!(tag: target_tag)
end
end
tag_name = st.tag_name
st.destroy!
tag_name.reload
tag_name.update!(canonical: target_tag.tag_name)
end
end