ActiveAdmin.register_page "Families Placement" do
menu label: "Populaire Familles"
page_action :update, method: :post do
Family.find(params['id']).update_attributes(id_1: params['id_1'], id_2: params['id_2'])
redirect_to "/"
end
content do
Family.all.order(id: :asc).each do |family|
form action: "families_placement/update", method: :post do |f|
columns do
panel family.name do
f.input :id, type: :hidden, value: family.id, name: 'id'
f.input :id_1, as: :select, collection: collect_posts, value: family.id_1, name: 'id_1'
f.input :id_2, as: :select, collection: collect_posts, value: family.id_2, name: 'id_2'
f.input :authenticity_token, type: :hidden, name: :authenticity_token, value: form_authenticity_token
f.input :submit, type: :submit
end
end
end
end
end
end
ActiveAdmin.
f.input :authenticity_token, type: :hidden, name: :authenticity_token, value: form_authenticity_token
: https://asafdav2.imtqy.com/2016/adding-forms-to-activeadmin-custom-pages/