Rails_admin and paranoia

862 Views Asked by At

Is there a way to manage the 'soft-deleted' records that paranoia produces when I delete something? What I mean is that any records I delete in rails_admin or rails console aren't actually deleted, instead paranoia marks them with a deleted_at timestamp, which takes them out of view scope.

I'd like to be able to see these deleted records for auditing, potential recovery, or to really delete them for good.

I have a basic install of rails_admin and paranoia, nothing special.

Also, this previously asked question was no help.

2

There are 2 best solutions below

6
On BEST ANSWER
list do
  scopes [nil, :only_deleted]
end

nil, simply means no scope, or original scope I should say. See more details on rails_admin's Wiki

Remember paranoia, simply adds a default scope, so records are hidden by default, but unscoped or one of the provided scopes should show them.

0
On

To restore soft deleted users you need to create RailsAdmin custom action. Here is a relevant post RailsAdmin custom action to restore soft deleted records.