I am working on the active admin gem. I just want to hide the delete link only from show page. So, I added the below code
ActiveAdmin.register ArticlesSkill do
menu :parent => "ReadUp"
actions :index, :show, :new, :create, :update, :edit
index do
column :name, sortable: :name
column :description
column "" do |resource|
links = ''.html_safe
links += link_to I18n.t('active_admin.view'), resource_path(resource), :class => "member_link edit_link"
links += link_to I18n.t('active_admin.edit'), edit_resource_path(resource), :class => "member_link edit_link"
if Article.where(articles_skill_id: resource.id).blank?
links += link_to I18n.t('active_admin.delete'), resource_path(resource), :method => :delete, :confirm => I18n.t('active_admin.delete_confirmation'), :class => "member_link delete_link"
else
# links += link_to I18n.t('active_admin.delete'), "#", :confirm => ("This Skill has A related Article. You Can't Delete This Now"), :class => "member_link delete_link"
links += link_to I18n.t('active_admin.delete'), resource_path(resource), :method => :delete, :confirm => I18n.t('active_admin.delete_confirmation'), :class => "member_link delete_link"
end
links
end
end
end
This is removing the delete link from the show page, But in the index page if I try to delete a record, its showing this error,
The action 'destroy' could not be found for Admin::ArticlesSkillsController
Any one can help me in this? Please.