# Bulk un-deletion

**URL:** https://meta.discourse.org/t/bulk-un-deletion/277861
**Category:** Feature
**Tags:** bulk-actions
**Created:** [September 5, 2023, 1:43pm UTC](https://meta.discourse.org/t/bulk-un-deletion/277861 "2023-09-05T13:43:31Z")
**Posts on this page:** 1
**Showing post:** 3

<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: [September 8, 2023, 2:45pm UTC](https://meta.discourse.org/t/bulk-un-deletion/277861/3 "2023-09-08T14:45:23Z")

</div>

This will find deleted topics created by user\_id 1.

```plaintext
dts=Topic.with_deleted.where(user_id: 1).where("deleted_at is not null");
dts.pluck(:deleted_at, :id)

```

```plaintext
dps=Post.with_deleted.where(user_id: 1).where("deleted_at is not null");
dbs.pluck(:deleted_at, :id)

```

And it looks like you can un-delete posts with something like

```plaintext
dp=dps.first
dp.deleted_at=nil
dp.deleted_by=nil
dp.save

```

And you’d do something similar for topics.

If it comes time to un-delete the stuff, the above should be enough for someone who knows a tiny bit about rails to be able to un-delete them all.

FWIW, if you had moved them to a hidden category, it would have been perhaps somewhat easier to bulk-revert-to-last-revision them all. But when neither of those things is possible for you at all, I think that’s a distinction without a difference.

Lastly, I’ll apologize for once again, treating a feature request as #Support . I think I do it because I have no power to make features, but I can solve problems.

---

_[View the full topic](https://meta.discourse.org/t/bulk-un-deletion/277861)._
