# Delete deleted-posts permanently in bulk?

**URL:** <https://meta.discourse.org/t/delete-deleted-posts-permanently-in-bulk/203289>\
**Category:** Support\
**Created:** [September 12, 2021, 4:15am UTC](https://meta.discourse.org/t/delete-deleted-posts-permanently-in-bulk/203289 "2021-09-12T04:15:12Z")\
**Posts on this page:** 1\
**Showing post:** 49

<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:** [November 28, 2021, 4:20am UTC](https://meta.discourse.org/t/delete-deleted-posts-permanently-in-bulk/203289/49 "2021-11-28T04:20:11Z")

</div>

Thanks Jay. This is what I get:

> [3] pry(main)\> p=  
> [3] pry(main)\* posts.first  
> =\> #\<Post:0x0000563a24cab908 id: 150\>  
> [4] pry(main)\> x=Post.find(p)  
> ArgumentError: You are passing an instance of ActiveRecord::Base to `find`. Please pass the id of the object by calling `.id`.  
> from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active\_record/relation/finder\_methods.rb:467:in `find\_one’

> [@pfaffman](#):
>
> I think you’d need to wrap your query in something to get it to be an array of posts rather than post ids.

Now, tell me about these wrap things. This is so annoying, because I know that @Sam’s rails command here should work, but I think that Rails has changed since then:

> [@The proper way to completely delete hundred of topics via rails?](https://meta.discourse.org/t/the-proper-way-to-completely-delete-hundred-of-topics-via-rails/90323/5):
>
> `Post.where('topic_id not in (select id from topics)').limit(100).destroy_all`

---

_[View the full topic](https://meta.discourse.org/t/delete-deleted-posts-permanently-in-bulk/203289)._
