17

我已将资源的标题作为指向Show操作的链接。现在我想删除那个链接表单default_actions

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

不会这样做,因为我需要show采取行动。

我也试过

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

但是删除链接不起作用,而是将我带到“显示”页面。

我会感谢任何帮助

4

2 回答 2

34

我是这样做的(resource_path)。

column "" do |resource|
  links = ''.html_safe
  links += link_to I18n.t('active_admin.edit'), edit_resource_path(resource), :class => "member_link edit_link"
  links += link_to I18n.t('active_admin.delete'), resource_path(resource), :method => :delete, :confirm => I18n.t('active_admin.delete_confirmation'), :class => "member_link delete_link"
  links
end
于 2012-06-21T12:11:03.147 回答
22

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

ActiveAdmin.register Foo do
  actions :all, except: [:edit, :destroy] #just show
  ...
于 2013-08-15T21:53:28.753 回答