# カテゴリーなしでトピックを削除できません

**URL:** <https://meta.discourse.org/t/cant-delete-topic-without-category/367811>\
**Category:** Product Support\
**Created:** [2025 年 5 月 27 日午後 6:19 UTC](https://meta.discourse.org/t/cant-delete-topic-without-category/367811 "2025-05-27T18:19:10Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2025 年 5 月 27 日午後 7:27 UTC](https://meta.discourse.org/t/cant-delete-topic-without-category/367811/4 "2025-05-27T19:27:11Z")

</div>

どうやら誰かがトピックが入っているカテゴリーを削除してしまったようですね？そんなことがあってはならないはずです。以下のようなことをする必要があると思います。

```plaintext
rails c
c=Category.last; # (あるいは何らかの方法でカテゴリーを取得する)
Topic.where(category_id: 4).update_all(category_id: c.id)

```

---

_[View the full topic](https://meta.discourse.org/t/cant-delete-topic-without-category/367811)._
