本文介绍了从ActiveAdmin default_actions中删除“显示”链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将资源的标题作为 Show 操作的链接。现在,我想删除该链接形式 default_actions

I've made a title of my resources as a link to a Show action. Now I want to remove that link form default_actions.

actions :all, :except => [:show]

不会,因为我需要 show 动作可用。

Won't do because I need show action to be available.

我也尝试过

column do |show|
  links = ''.html_safe
  links += link_to "Edit", edit_admin_show_path(show)
  links += ' '
  links += link_to "Del", admin_show_path(show), :confirm => 'Are you sure?', :method => :delete
  links
end

但是删除链接无效,而是带我进入 Show 页面。

But delete link isn't working but rather takes me to the Show page.

我将很感谢您的帮助

推荐答案

较新的版本支持在资源定义内调用操作方法:

More recent versions support a call to actions method within the resource definition:

ActiveAdmin.register Foo do
  actions :all, except: [:edit, :destroy] #just show
  ...

这篇关于从ActiveAdmin default_actions中删除“显示”链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 16:07