I would like to get all deleted records change by paranoia on admin panel with administrate. My problem is that I'm finding a way to do this stuff but until now without success
Actually what I'm trying to do is to override index method on a specific controller generate with Administrate
, in order to get all elements (deleted or not) as resources for the current controller. Like so:
controllers/admin/foo_controller.rb
module Admin
class FooController < Admin::ApplicationController
super
resources = Foo.where("at_delete IS NOT NULL").page(params[:page])
end
end
But when I create a foo object from the admin panel, and after removed it. The record isn't display anymore and I would like to get it still visible for giving the possibility to admin to change it.
If anyone has an opinion to make this possible, it would be nice.
Thank you in advance for your help.
First of all a big thanks to @Tom Lord, that help me to solved my problem, and that is the solution:
app/controllers/admin/application_controller.rb
generate byAdministrate
as below:app/dashboards/foo_dashboard.rb
Of course change
deleted_at
field depends on the migration you may have done in order to add paranoia gem.