# 이 카테고리에 1개의 게시물이 있어 삭제할 수 없습니다

**URL:** https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648
**Category:** Support
**Created:** [12월 30, 2020, 9:50오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648 "2020-12-30T21:50:02Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)
#### Post date: [12월 30, 2020, 9:50오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/1 "2020-12-30T21:50:03Z")

</div>

[Using topic.destroy(id) to delete illegal content](https://meta.discourse.org/t/using-topic-destroy-id-to-delete-illegal-content/84239/5)에서 이어지는 논의입니다:

이 주제를 삭제하는 방법을 모르겠습니다. 오류가 발생하거든요.

![1-topic](https://cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/meta/original/3X/4/f/4ff0c9129dba0d0e639e3ed5c0740d496e834dab.png)

이 주제가 삭제되면 카테고리도 함께 삭제됩니다.

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [12월 31, 2020, 3:21오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/2 "2020-12-31T15:21:53Z")

</div>

주제를 다른 카테고리로 이동하세요. 이 주제를 비공개로 만들고 싶다면, 예를 들어 '스태프’와 같은 비공개 카테고리로 이동하세요. 지정된 기간이 지나면 주제가 완전히 삭제됩니다.

---

<div class="post-metadata">

### Author: ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)
#### Post date: [12월 31, 2020, 4:42오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/3 "2020-12-31T16:42:18Z")

</div>

이동해 보았지만, 다음 오류가 표시됩니다: 죄송합니다. 오류가 발생했습니다.

> **요약**
>
> 메시지
> 
> NoMethodError (undefined method `revise' for nil:NilClass) lib/topics_bulk_action.rb:101:in `block in change\_category’  
> lib/topics\_bulk\_action.rb:98:in `change_category' lib/topics_bulk_action.rb:28:in `perform!’  
> app/controllers/topics\_controller.rb:879:in `bulk' app/controllers/application_controller.rb:358:in `block in with\_resolved\_locale’  
> app/controllers/application\_controller.rb:358:in `with_resolved_locale' lib/middleware/omniauth_bypass_middleware.rb:68:in `call’  
> lib/content\_security\_policy/middleware.rb:12:in `call' lib/middleware/anonymous_cache.rb:354:in `call’  
> config/initializers/100-quiet\_logger.rb:23:in `call' config/initializers/100-silence_logger.rb:31:in `call’  
> lib/middleware/enforce\_hostname.rb:22:in `call' lib/middleware/request_tracker.rb:176:in `call’
> 
> 스택 트레이스
> 
> lib/topics\_bulk\_action.rb:101:in `block in change_category' activerecord (6.0.3.3) lib/active_record/relation/delegation.rb:87:in `each’  
> activerecord (6.0.3.3) lib/active\_record/relation/delegation.rb:87:in `each' lib/topics_bulk_action.rb:98:in `change\_category’  
> lib/topics\_bulk\_action.rb:28:in `perform!' app/controllers/topics_controller.rb:879:in `bulk’  
> actionpack (6.0.3.3) lib/action\_controller/metal/basic\_implicit\_render.rb:6:in `send_action' actionpack (6.0.3.3) lib/abstract_controller/base.rb:195:in `process\_action’  
> actionpack (6.0.3.3) lib/action\_controller/metal/rendering.rb:30:in `process_action' actionpack (6.0.3.3) lib/abstract_controller/callbacks.rb:42:in `block in process\_action’
> 
> 환경
> 
> HTTP HOSTS: discuss.noisebridge.info

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [12월 31, 2020, 5:01오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/4 "2020-12-31T17:01:12Z")

</div>

잘 모르겠습니다. 주제를 이동한 경우, 메시지를 선택하고 이동하는 방법을 시도해 보셨을 것입니다.

대신 주제 제목을 직접 편집하고 해당 위치에서 카테고리를 변경해 보세요. 주제가 삭제된 상태라면 제목을 편집하려면 먼저 삭제 해제(복원)가 필요할 수 있습니다.

---

<div class="post-metadata">

### Author: ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)
#### Post date: [12월 31, 2020, 5:33오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/5 "2020-12-31T17:33:11Z")

</div>

토픽 제목은 수정할 수 있었습니다. 하지만 이동이나 삭제는 불가능합니다. 이식을 시도하면 토픽 카테고리가 변경되었다가, 잠시 후 즉시 원래대로 되돌아가는 것을 확인할 수 있습니다.

실제로 해당 카테고리에는 두 개의 토픽이 있습니다.

[https://discuss.noisebridge.info/c/about/3](https://discuss.noisebridge.info/c/about/3)

1. `https://discuss.noisebridge.info/t/post/2`  
삭제 옵션이 표시되지 않습니다. 이동도 불가능합니다. 토픽 제목은 수정할 수 있었습니다.

2. 다른 카테고리의 손상된 링크된 토픽  
이 게시글도 삭제할 수 없음을 확인했습니다. 삭제를 시도하면 빨간색으로 변하고 아무 반응도 없습니다.

3. `https://discuss.noisebridge.info/t/about/1992/1`  
이것은 카테고리의 설명입니다. 답변 수가 -1로 표시되며 열 수 없습니다.  
`:( 로드를 시도하는 동안 오류가 발생했습니다. 문제가 발생했습니다.`

도움 주셔서 감사합니다!

---

<div class="post-metadata">

### Author: ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)
#### Post date: [12월 31, 2020, 6:11오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/6 "2020-12-31T18:11:44Z")

</div>

로그에서 3개의 오류를 확인했습니다. 오류는 다음과 같습니다:

1번째 오류

> **요약**
>
> 메시지
> 
> ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation “categories” does not exist  
> LINE 1: SELECT categories.\*, t.slug topic\_slug FROM “categories” LEF…  
> ^  
> )  
> (eval):105:in `exec_params' app/models/site.rb:40:in `categories’  
> app/models/site.rb:12:in `initialize' app/models/site.rb:113:in `new’  
> app/models/site.rb:113:in `json_for' app/controllers/application_controller.rb:552:in `preload\_anonymous\_data’  
> app/controllers/application\_controller.rb:378:in `preload_json' app/controllers/application_controller.rb:358:in `block in with\_resolved\_locale’  
> app/controllers/application\_controller.rb:358:in `with_resolved_locale' lib/middleware/omniauth_bypass_middleware.rb:68:in `call’  
> lib/content\_security\_policy/middleware.rb:12:in `call' lib/middleware/anonymous_cache.rb:352:in `call’  
> config/initializers/100-quiet\_logger.rb:23:in `call' config/initializers/100-silence_logger.rb:31:in `call’  
> lib/middleware/enforce\_hostname.rb:22:in `call' lib/middleware/request_tracker.rb:176:in `call’
> 
> 스택 트레이스
> 
> rack-mini-profiler (2.2.0) lib/patches/db/pg.rb:69:in `exec_params' rack-mini-profiler (2.2.0) lib/patches/db/pg.rb:69:in `exec\_params’  
> (eval):105:in `exec_params' activerecord (6.0.3.3) lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec\_no\_cache’  
> activesupport (6.0.3.3) lib/active\_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads' activesupport (6.0.3.3) lib/active_support/concurrency/share_lock.rb:187:in `yield\_shares’  
> activesupport (6.0.3.3) lib/active\_support/dependencies/interlock.rb:47:in `permit_concurrent_loads' activerecord (6.0.3.3) lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `block in exec\_no\_cache’  
> activerecord (6.0.3.3) lib/active\_record/connection\_adapters/abstract\_adapter.rb:722:in `block (2 levels) in log' activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize’
> 
> 환경
> 
> HTTP HOSTS: discuss.noisebridge.info

2번째 오류

> **요약**
>
> 메시지 (3회 보고됨)
> 
> ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation “categories” does not exist  
> LINE 1: SELECT categories.\*, t.slug topic\_slug FROM “categories” LEF…  
> ^  
> )  
> (eval):105:in `exec_params' app/models/site.rb:40:in `categories’  
> app/models/site.rb:12:in `initialize' app/models/site.rb:113:in `new’  
> app/models/site.rb:113:in `json_for' app/controllers/application_controller.rb:552:in `preload\_anonymous\_data’  
> app/controllers/application\_controller.rb:378:in `preload_json' app/controllers/application_controller.rb:358:in `block in with\_resolved\_locale’  
> app/controllers/application\_controller.rb:358:in `with_resolved_locale' lib/middleware/omniauth_bypass_middleware.rb:68:in `call’  
> lib/content\_security\_policy/middleware.rb:12:in `call' lib/middleware/anonymous_cache.rb:352:in `call’  
> config/initializers/100-quiet\_logger.rb:23:in `call' config/initializers/100-silence_logger.rb:31:in `call’  
> lib/middleware/enforce\_hostname.rb:22:in `call' lib/middleware/request_tracker.rb:176:in `call’
> 
> 스택 트레이스
> 
> rack-mini-profiler (2.2.0) lib/patches/db/pg.rb:69:in `exec_params' rack-mini-profiler (2.2.0) lib/patches/db/pg.rb:69:in `exec\_params’  
> (eval):105:in `exec_params' activerecord (6.0.3.3) lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec\_no\_cache’  
> activesupport (6.0.3.3) lib/active\_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads' activesupport (6.0.3.3) lib/active_support/concurrency/share_lock.rb:187:in `yield\_shares’  
> activesupport (6.0.3.3) lib/active\_support/dependencies/interlock.rb:47:in `permit_concurrent_loads' activerecord (6.0.3.3) lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `block in exec\_no\_cache’  
> activerecord (6.0.3.3) lib/active\_record/connection\_adapters/abstract\_adapter.rb:722:in `block (2 levels) in log' activesupport (6.0.3.3) lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize’
> 
> 환경
> 
> HTTP HOSTS: discuss.noisebridge.info

3번째 오류

> **요약**
>
> 메시지
> 
> Job exception: PG::UndefinedTable: ERROR: relation “application\_requests” does not exist  
> LINE 1: SELECT “application\_requests”.“id” FROM "application\_request…  
> ^
> 
> 스택 트레이스
> 
> /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-2.2.0/lib/patches/db/pg.rb:69:in `exec_params' /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-2.2.0/lib/patches/db/pg.rb:69:in `exec\_params’  
> (eval)💯in `exec_params' /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec\_no\_cache’  
> /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active\_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads' /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/share_lock.rb:187:in `yield\_shares’  
> /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active\_support/dependencies/interlock.rb:47:in `permit_concurrent_loads' /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `block in exec\_no\_cache’  
> /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active\_record/connection\_adapters/abstract\_adapter.rb:722:in `block (2 levels) in log' /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize’

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [12월 31, 2020, 8:22오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/7 "2020-12-31T20:22:47Z")

</div>

추측컨대, 최근에 Discourse를 설정하셨나요?

카테고리가 생성될 때 항상 “About Category”(카테고리 소개) 게시글이 자동 생성됩니다. 다른 게시글은 초기 설정 시 생성되는 시스템 게시글 중 하나로 보입니다. 초기 특수 카테고리 중 하나를 재사용하신 경우일 수 있습니다.

더 자세한 지식을 가진 분의 도움이 필요할 수 있습니다. @codinghorror 또는 팀 멤버 중 한 분에게 문의해 보시는 것이 좋습니다.

보아하니 레이아웃이 꽤 깔끔하네요.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [12월 31, 2020, 8:39오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/8 "2020-12-31T20:39:13Z")

</div>

[https://discuss.noisebridge.info/c/about/3](https://discuss.noisebridge.info/c/about/3) 페이지로 이동하면 두 개의 주제가 표시됩니다. 제 추측으로는 "About"이라는 제목의 주제가 About 카테고리의 “About” 주제일 것입니다. 해당 주제의 원래 제목은 아마도 "About the About category"였을 것입니다.

Discourse는 사이트에 카테고리를 만들 때마다 자동으로 “About” 주제를 생성합니다. 이 주제는 카테고리를 삭제하기 전에 삭제할 필요가 _없습니다_. 사이트가 정상적으로 작동하고 있다면, 카테고리 내의 다른 주제를 삭제한 후 카테고리를 삭제할 수 있어야 합니다.

이 방법이 작동하지 않는다면, About 주제가 이상한 상태에 빠진 것일 수 있습니다. UI에서 답변 수가 -1개로 표시되므로 뭔가 문제가 생긴 것으로 보입니다. 아마도 사이트 백엔드에서 해당 주제의 첫 번째 게시물을 삭제했을 수 있습니다. 만약 그렇다면 이제 카테고리를 삭제할 수 없는 상태이므로 알려주시면 해결책을 찾아보겠습니다.

---

<div class="post-metadata">

### Author: ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)
#### Post date: [12월 31, 2020, 9:33오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/9 "2020-12-31T21:33:48Z")

</div>

> [@Heliosurge](#):
>
> 카테고리가 생성될 때 항상 “About Category”라는 제목의 게시글이 생성됩니다. 다른 게시글은 초기 설정 시 생성되는 시스템 게시글 중 하나로 보입니다. 초기 특수 카테고리 중 하나를 다른 용도로 repurpose(재활용)하셨다면요.

네, 미리 생성되어 있습니다. 모든 게시글을 `site-feedback` 태그가 있는 일반 카테고리로 이동시켜 이를 제거하려고 시도하고 있습니다.

> [@simon](#):
>
> 만약 해당 상황이라면 이제 카테고리를 삭제할 수 없게 되었다면 알려주시면 해결책을 찾아보겠습니다.

_카테고리 삭제를 시도하면 다음과 같은 메시지가 표시됩니다:_

> 게시글이 1개 존재하여 이 카테고리를 삭제할 수 없습니다. 가장 오래된 게시글은 [About](https://discuss.noisebridge.info/t/about/1992)입니다.

[위에서 언급된 오류 정보가 도움이 될까요?](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/6) 피드백 감사합니다.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [12월 31, 2020, 9:42오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/10 "2020-12-31T21:42:32Z")

</div>

> [@sunjam](#):
>
> 이 카테고리에는 1개의 주제가 있어 삭제할 수 없습니다. 가장 오래된 주제는 [About](https://discuss.noisebridge.info/t/about/1992)입니다.

사이트의 Rails 콘솔에서 다음을 실행하면 무엇이 보이는지 알려주시겠어요?

`Category.find 3`

문제가 있는 카테고리의 ID는 `3`입니다. 궁금한 점은 해당 카테고리의 `topic_id` 속성 값이 무엇인지입니다.

---

<div class="post-metadata">

### Author: ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)
#### Post date: [1월 1, 2021, 6:52오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/11 "2021-01-01T18:52:38Z")

</div>

> **Category.find 3 rails 출력**
>
> #\<Category:0x000055cde953bee0  
> id: 3,  
> name: “About”,  
> color: “231F20”,  
> topic\_id: 2,  
> topic\_count: 1,  
> created\_at: Thu, 06 Dec 2018 07:19:46 UTC +00:00,  
> updated\_at: Thu, 31 Dec 2020 05:33:14 UTC +00:00,  
> user\_id: -1,  
> topics\_year: 1,  
> topics\_month: 0,  
> topics\_week: 0,  
> slug: “about”,  
> description: “All about using Discuss, and adding your suggestions to improve it.”,  
> text\_color: “Ff0000”,  
> read\_restricted: false,  
> auto\_close\_hours: nil,  
> post\_count: 0,  
> latest\_post\_id: 9231,  
> latest\_topic\_id: 1992,  
> position: 1,  
> parent\_category\_id: nil,  
> posts\_year: 0,  
> posts\_month: 0,  
> posts\_week: 0,  
> email\_in: nil,  
> email\_in\_allow\_strangers: false,  
> topics\_day: 0,  
> posts\_day: 0,  
> allow\_badges: true,  
> name\_lower: “about”,  
> auto\_close\_based\_on\_last\_post: false,  
> topic\_template:  
> "## Curious about our forum? Want to learn more?\n[Be sure to check our wiki](https://noisebridge.net/wiki/Noisebridge) for any information you cannot find here.\n\n`@help` will contact our helpful volunteers. 🥰 \n`@staff` will contact all mods and admins. Remember, they are volunteers. :thank\_you: \n\nIf you are seeking help on a project, check our #projects category. ",  
> contains\_messages: nil,  
> sort\_order: “”,  
> sort\_ascending: nil,  
> uploaded\_logo\_id: 1349,  
> uploaded\_background\_id: nil,  
> topic\_featured\_link\_allowed: true,  
> all\_topics\_wiki: true,  
> show\_subcategory\_list: false,  
> num\_featured\_topics: 5,  
> default\_view: “”,  
> subcategory\_list\_style: “rows\_with\_featured\_topics”,  
> default\_top\_period: “all”,  
> mailinglist\_mirror: false,  
> minimum\_required\_tags: 0,  
> navigate\_to\_first\_post\_after\_read: false,  
> search\_priority: 0,  
> allow\_global\_tags: false,  
> reviewable\_by\_group\_id: nil,  
> required\_tag\_group\_id: nil,  
> min\_tags\_from\_required\_group: 1,  
> read\_only\_banner: “”,  
> default\_list\_filter: “all”\>

topic\_id 2

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [2월 2, 2021, 11:48오후 UTC](https://meta.discourse.org/t/cant-delete-this-category-because-it-has-1-topic/174648/12 "2021-02-02T23:48:23Z")

</div>

저도 같은 문제를 겪고 있습니다. 제 카테고리 ID는 89입니다(이상한 ID는 아닙니다)만, About 주제 하나만 있는데도 주제 수가 1로 표시됩니다.

해당 카테고리가 문제를 일으켰습니다. 이는 하위 카테고리인데, 어떤 이유에서인지 그 안의 게시물이 상위 카테고리 목록에 전혀 표시되지 않았습니다(다른 하위 카테고리는 정상적이었습니다). 그래서 주제를 새로운 하위 카테고리로 이동하기로 결정했는데, 잘 작동했습니다. 단, 한 주제는 이동할 수 없었습니다. 저는 그것이 원인이 될 것이라 판단하여 콘솔을 통해 삭제했습니다.

이 작업을 수행하는 동안 개수가 변경되지 않아서 이 문제가 발생했다고 추측합니다.

더 이상의 문제를 일으키지 않으면서 이 번거롭고 이제 무용지물이 된 카테고리를 제거하는 데 어떤 방법을 추천하시나요?
