I have a infrastructure object composed for many datacenters. In the apps/admin/infrastructures.rb I have the following code:
form do |f|
f.inputs "Infrastructure details" do
f.input :name
f.has_many :datacenters do |datacenter_form|
datacenter_form.input :name
end
end
f.buttons
end
I can add datacenters with no problems but I don’t know how I can delete it from infrastructure form.
Sep 2017 Update:
Rails 5.1.4, ActiveAdmin 1.0.0
Append
:idand_destroyinpermit_paramsalong with other attributes from the model e.g.:namein your case. Then provide the:allow_destroyoption inf.has_manytoo. Other requirements remain the same; like addingallow_destroy: trueinaccepts_nested_attributes_for.Final look:
ActiveAdmin Reference
This worked for me:
and in the Model remember to add :allow_destroy :