如何从activeAdmin中删除删除选项?

Kar*_*hem 43 rubygems ruby-on-rails activeadmin

在rails gem active admin我想从default_actions中删除删除选项,而我仍然需要编辑和显示操作,有什么办法吗?

Tho*_*son 98

actions向每个Active Admin资源添加一个调用:

ActiveAdmin.register Foobar do
  actions :all, :except => [:destroy]
end
Run Code Online (Sandbox Code Playgroud)


vla*_*iov 7

在某些时候我遇到了这个问题,因为破坏方法,"删除"按钮并没有消失

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
Run Code Online (Sandbox Code Playgroud)