Bulk un-deletion

This will find deleted topics created by user_id 1.

dts=Topic.with_deleted.where(user_id: 1).where("deleted_at is not null");
dts.pluck(:deleted_at, :id)
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

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.

4 Likes