# מחיקת קטגוריה? (או הנושא "אודות קטגוריה זו" שהיה תחתיה)

**URL:** https://meta.discourse.org/t/undelete-a-category-or-the-about-this-category-topic-that-was-under-it/183602
**Category:** Support
**Created:** [17 במרץ,‏ 2021,‏ 11:20pm UTC](https://meta.discourse.org/t/undelete-a-category-or-the-about-this-category-topic-that-was-under-it/183602 "2021-03-17T23:20:35Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![SouperC](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/souperc/32/62875_2.png) [@SouperC](https://meta.discourse.org/u/SouperC)
#### Post date: [17 במרץ,‏ 2021,‏ 11:20pm UTC](https://meta.discourse.org/t/undelete-a-category-or-the-about-this-category-topic-that-was-under-it/183602/1 "2021-03-17T23:20:35Z")

</div>

I spent some time searching, but didn’t find anything directly related to this…  
Is there a way to undelete a category? More specifically I need to recover the “about this category” topic that resided from a newly created category… that I then deleted.

Tried poking around with different URLs in my browser history but no luck. Backup is no good as this all happened in the last 20 mins or so and backups are daily.

Backstory:

- I created a “parent” classifieds category with two sub categories.
- Spent a bunch of time writing the guidelines under the “about this category topic” on that parent.
- Moved the two sub categories to the “root” as there was no need for the parent really..
- Then went on to delete the original parent category, along with the about this category topic,

Appreciate any ideas folks might have. I’m not developer, but I can poke around in DB or rails if needed with guidance.

---

<div class="post-metadata">

### Author: ![SouperC](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/souperc/32/62875_2.png) [@SouperC](https://meta.discourse.org/u/SouperC)
#### Post date: [19 במרץ,‏ 2021,‏ 5:50pm UTC](https://meta.discourse.org/t/undelete-a-category-or-the-about-this-category-topic-that-was-under-it/183602/2 "2021-03-19T17:50:50Z")

</div>

Welp, any ideas? I’m not even sure what I’d search for in the DB.

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/6/860f9cd71cdb2a3a23934a012268acb64717d571.png)

From working backwards with the topicID in the URL, the topicID that I think I need to recover is 7078, perhaps I can do something with this number?

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [19 במרץ,‏ 2021,‏ 7:32pm UTC](https://meta.discourse.org/t/undelete-a-category-or-the-about-this-category-topic-that-was-under-it/183602/3 "2021-03-19T19:32:10Z")

</div>

I guess  
`./launcher enter app`  
then  
`rails c`  
and  
`Topic.with_deleted.where(id: 7078).recover!`

…but I tried and didn’t work as expected. Not sure why 🤔 You’d have to change its category\_id too I think.

With the post number you could try:  
`Post.with_deleted.where(id: the_post_id).pluck("raw")`  
or as there was probably only one post in the topic:  
`Post.with_deleted.where(topic_id: 7078).pluck("raw")`

That should give you something to copy 🤞

---

<div class="post-metadata">

### Author: ![SouperC](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/souperc/32/62875_2.png) [@SouperC](https://meta.discourse.org/u/SouperC)
#### Post date: [20 במרץ,‏ 2021,‏ 1:48am UTC](https://meta.discourse.org/t/undelete-a-category-or-the-about-this-category-topic-that-was-under-it/183602/5 "2021-03-20T01:48:07Z")

</div>

> [@Benjamin\_D](#):
>
> Post.with\_deleted.where(topic\_id: 7078).pluck(“raw”)

Thanks, this got me the text from the post which is good enough!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [19 באפריל,‏ 2021,‏ 1:48am UTC](https://meta.discourse.org/t/undelete-a-category-or-the-about-this-category-topic-that-was-under-it/183602/6 "2021-04-19T01:48:50Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
