0

I am trying to add a link to the show of an ActiveAdmin resource, Volunteer_Details.

After editing a record in the model, there is no link to the index of that resource.

I know I can simply click the resource page link at the top, but I'd like to add a link in the show view of each record for convenience.

I have looked here and attempted to follow that method to add a link.

My code looks like this:

    show do
attributes_table do
  row :id
row 'Name' do |m|
    m.participant.first_name + ' ' +m.participant.last_name
end
row :date
row :importance
row :story
row :questions
row :created_at
row :updated_at
row 'Go Back' do
    link_to 'Volunteer Details', admin_volunteer_detail_path
   end

end


active_admin_comments
    end

If I am on this record http://localhost:3000/admin/volunteer_details/4

My code links back to this

The link that my show view creates links back to the page I am already on, and not `http://localhost:3000/admin/volunteer_details/

I would like the link to go back to the volunteer_details index page.`

dbate
  • 127
  • 13

1 Answers1

2

you can add a link on the top resource links as,

action_item :view, only: :show do
  link_to 'Volunteer Details', admin_volunteer_details_path
end

or

row 'Go Back' do
    link_to 'Volunteer Details', admin_volunteer_details_path
   end

end

in your code

note that index path is not admin_volunteer_detail_path but it should be admin_volunteer_details_path

roshiend
  • 554
  • 5
  • 12