Reputation: 65
I got resource and pages structure with this code
resource_collection = ActiveAdmin.application.namespaces[:admin].resources
from here
Resource has a hash menu_item_options with id, label, url, if, parent.
I tried in rails console
resource_collection.first.menu_item_options[:parent]
and it is filled, but inside my page it is blank.
How I can get ActiveAdmin menu structure in ActiveAdmin page?
Upvotes: 2
Views: 513
Reputation: 2978
The default menu is available via
ActiveAdmin.application.namespaces[:admin].fetch_menu(:default)
Items are displayed if item.should_display evaluates to true. By default for a resource item this is based on whether the current user is authorized to read the resource, but it can be overridden with the item if: option. If no menu items are displayed most likely it is an authorization issue.
Upvotes: 2