Search code examples
ruby-on-railsactiveadmin

how do add a link to an ActiveAdmin view


I have:

ActiveAdmin.register User do
  show :title => :name do     
    attributes_table do
      row :username
      row :email
      row :last_request_at
      row :foo
    end
  end
end

and I want foo just make a <a href="/foo">foo</a> in the view.

So I define:

def foo
  <a href="/foo">foo</a>
end

in the user.rb model. And it displays but the tag is escaped so it's not clickable. Is there a simple way to do this?


Solution

  • You can try:

    row :foo do
      link_to('foo','#')
    end
    

    and replace '#' with your route.