How to remove the delete option form activeAdmin?
Another way to remove actions from default_actions for an ActiveAdmin
resource is via config
variable, like:
ActiveAdmin.register MyUser do
config.remove_action_item(:destroy)
...
end
One way is already mentioned in the accepted answer via
actions
method.
At some point I had this problem, because of the destroy method, the 'Delete' button didn't disappear
actions :all, except: [:destroy]
controller do
def destroy # => Because of this the 'Delete' button was still there
@user = User.find_by_slug(params[:id])
super
end
end
The accepted answer threw an exception, "wrong number of arguments" so I did this to exclude the delete button(:destroy action)
ActiveAdmin.register YourModel do
actions :index, :show, :new, :create, :update, :edit
index do
selectable_column
id_column
column :title
column :email
column :name
actions
end
You add a call to actions
to every Active Admin resource:
ActiveAdmin.register Foobar do
actions :all, :except => [:destroy]
end