0
votes

I'll preface this by saying I know little to nothing about Ruby on Rails. I inherited a RoR project and have to make some minor changes that the documentation for ActiveAdmin does not list. Seems like a minor change like removing an anchor link should be simple, but it's not. Here is the code block I'm working with:

div do
  panel("Child Licenses") do
    table_for(user.desktop_licenses) do
      column :id do |license|
        link_to license.id, license
      end
      column :parent_license do |license|
        license.license
      end
      column :expires_at
      column :created_at
    end
  end
end

I have a panel with a table inside displaying a couple columns of data. The license.id links to a page for the appropriate license id, which is correct, but the license.license in the second column has a corresponding parent license page that automatically links to the parent license page. I want to remove that automatic link from the license.license column, but all the Googling in the world doesn't seem to turn up anything for me. I've looked at the auto_link Ruby method and tried messing around with that, but my limited knowledge of Ruby is hindering me. Is there any sort of filter for ActiveAdmin that can just turn off the automatic linking on that one line?

I came across this url https://gorails.com/forum/remove-activeadmin-automatic-link-on-show-view that asks the same question probably in a better way if that helps for context. That is what I'm trying to do. Any help would be appreciated.

2
license.license will go to parent license show page? - uday
license.license creates an auto link to the parent license show page. In this case it creates a <a> tag that displays something like a link with the text Demo that is clickable. All I am trying to do is display the text Demo and remove the <a> tag, essentially disabling the auto linking on it. I hope that makes sense. This auto linking is new to me. - CLosee

2 Answers

1
votes

Try changing

column :parent_license do |license|
  license.license
end

into

column "Parent license" do |license|
  span { license.license.to_s }
end

I think this will prevent AA's magic kicking in. Good luck!

0
votes

Change it to

column "Parent license" do |license|
  span { license.license.name }
end

if there is name attribute to license else you can show what ever attribute you want to display.