Could you just delete them?
u=User.find_by_username('byebye')
posts=Post.where(user_id: u.id)
and then call PostDestroyer on all of the posts. (I don’t remember exactly how to do that offhand.)
If you really want to replace their posts with “deleted by…” then you’d do something like
posts.update_all(raw: "deleted by user request")
And then you’d need to wipe stuff from the PostRevision model, maybe
posts.each do |p|
bad=PostRevision.where(post_id: p.id)
bad.destroy_all
end
You’d want to do a couple of those by hand as a test, or on a staging site if you’re really careful.