I have some problem.
In ActiveAdmin I need hide DELETE action by condition.
I did it for #index
page. But I don't know how do this trick with #show page.
Here's code:
index do
selectable_column
column :id do |package|
link_to package.id, admin_subscription_package_path(package)
end
column :title
column :plan_status
column :duration do |package|
if package.duration == 1
"#{package.duration} day"
else
"#{package.duration} days"
end
end
column 'Price (USD)', :price do |package|
number_to_currency(package.price, locale: :en)
end
column :actions do |object|
raw(
%(
#{link_to 'View', admin_subscription_package_path(object)}
#{(link_to 'Delete', admin_subscription_package_path(object),
method: :delete) unless object.active_subscription? }
#{link_to 'Edit', edit_admin_subscription_package_path(object)}
)
)
end
end
Or maybe I can do it more useful for all pages at once.
Use action_item for this purpose: