1

Please help to understand how to add link to show in active admine.

My code now

  show do |ad|
    attributes_table do
      row :title
      row :slug
      row :short_description
      row :categories do
        ad.categories.pluck(:name).join(', ')
      end
      row :image do
        image_tag(ad.image.url(:custom), style: 'width: 50%')
      end
      row :header_bg do
        image_tag(ad.header_bg.url(:custom), style: 'width: 50%')
      end
      row 'Link to post' do
        'www.somepage.com/blog/' + post.slug
      end
    end
  end

My solution is below, but I need here active link - clickable.

  row 'Link to post' do
    'www.somepage.com/blog/' + post.slug
  end

I found similar problem here: how do add a link to an ActiveAdmin view

but this solution use admin route as root. Maybe somebody know how to get around this?

Thank you in advace.

a.kozubenko
  • 1,030
  • 3
  • 15
  • 24

1 Answers1

1

Try using an Arbre link element:

row 'link to post' do
  a('http://www.somepage.com/blog/' + post.slug', href: 'http://www.somepage.com/blog/' + post.slug)
end
Piers C
  • 2,880
  • 1
  • 23
  • 29