我已将我的资源标题作为 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
但删除链接无效,而是带我进入显示页面。
我会感谢任何帮助
答案 0 :(得分:33)
我是这样做的(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
答案 1 :(得分:22)
更新的版本支持在资源定义中调用actions方法:
ActiveAdmin.register Foo do
actions :all, except: [:edit, :destroy] #just show
...