How to disable active_admin_import action by condition on index page
I have a code to disable 'new, create, destroy' actions by condition. Need to do same with active_admin_import
controller do
def action_methods
if Admin::PurchaseOrderDecorator.decorate(parent).received?
super - %w(new create destroy)
else
super
end
end
end
active_admin_import(
....
)
you can use
ifoptionhttps://github.com/activeadmin-plugins/active_admin_import/commit/aa0be4bbb3151ab50911c1041415044936fba068
something like this might work
However one more option to handle conditional access to actions through policies
Docs
https://activeadmin.info/13-authorization-adapter.html
Pundit https://github.com/varvet/pundit