Remove 'Show' link from ActiveAdmin default_actions

12,042

Solution 1

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

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

Solution 2

I did it this way (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
Share:
12,042

Related videos on Youtube

Uko
Author by

Uko

I'm a software developer / computer science researcher who just loves everything related to the software engineering. Although I'm continuously learning something new and different, my main field of interest is software evolution. I know key concepts of oop, tdd, bdd, java, eclipse, c, ruby… But my main question remains the same: „How do you create a living system that is going to evolve and not begin dying slowly after the release (or even before)?“

Updated on June 04, 2022

Comments

  • Uko
    Uko almost 2 years

    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]
    

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

    I'le also tried

    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
    

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

    I'll be thankful for any help

  • MBHNYC
    MBHNYC almost 12 years
    This was really helpful @pedro - I with an example like this was in the product documentation — one question, I'm trying to make a link that behaves remotely — any comment on how to get some javascript dumped in here that refers to the rows correctly?
  • phuk
    phuk almost 12 years
    @MBHNYC what exactly are you trying to do? Make link which sends ajax request with row data?
  • MBHNYC
    MBHNYC almost 12 years
    Actually I got it, I was trying to add jQuery that modified the link after the remote success object came back, but it was far simpler just to run the task non-remotely and re-render the index page, so I did that. Thx!
  • naveed
    naveed over 9 years
    +1, just a minor thing, you dont even need to pass first empty string argument.
  • nicosierra
    nicosierra about 9 years
    If you delete a registry and the JS confirmation pop-up doesn't show up, try replacing the fourth line with this : links += link_to I18n.t('active_admin.delete'), resource_path(resource), :method => :delete, data: {confirm: I18n.t('active_admin.delete_confirmation')}, :class => "member_link delete_link" see source code