I've got MenuItem's nested under Menu using a belongs_to
This works great if i do not declare the index block (active admin works it out automagically) but if i declare my own block it shows all the MenuItems for all the menus.
How can I tell my block to respect the nested resource?
UPDATE - I think this is to do with https://github.com/nebirhos/activeadmin-sortable-tree rather than activeadmin core.
So i guess the question becomes: Is it possible to use sortable tree with nested resources?
ActiveAdmin.register MenuItem do
config.filters = false
config.paginate = false
belongs_to :menu
sortable tree: true
permit_params :title, :url, :menu_id
index as: :sortable do
label "Title" do |menu_item|
link_to menu_item.title, edit_admin_menu_menu_item_path( menu_item.menu, menu_item )
end
actions defaults: false do |menu_item|
link_to "Delete", admin_menu_menu_item_path( menu_item.menu, menu_item ), method: "delete", confirm: "Are you sure?"
end
end
form do |f|
f.inputs "Details" do
f.input :title
f.input :url
f.input :menu_id, :as => :hidden
end
f.actions
end
end