a.kozubenko
a.kozubenko

Reputation: 1060

add link in ActiveAdmine to show action

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.

Upvotes: 1

Views: 256

Answers (1)

Piers C
Piers C

Reputation: 2978

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

Upvotes: 1

Related Questions