I want to show the link in the show view of ActiveAdmin. But it should not show up in the grid of the index view. I can't figure out how to do this. I've already tried quite a few approaches.
attempt 1
actions :all, except: proc{ params['id'].present? ? [:new, :destroy] : [:new, :destroy, :edit] }.call
this fails with undefined local variable or method 'params'
attempt 2
actions :all, only: :show, except: [:new, :destroy, :edit]
action_item only: :show do
link_to 'Edit Cash Out', "/admin/documents/#{params['id']}/edit" if params['id']
end
this fails because the route isn't being created for the edit path
attempt 3
actions :all, except: [:new, :destroy].tap do |a|
a << :edit unless params['id'].present?
end
fails with no block given