How to create a nested custom page in ActiveAdmin?

788 Views Asked by At

I need to create a nested custom page inside a resource.

The route should be like this:
/admin/quizzes/:id/my_custom_page

The problem is that we can't use belongs_to in ActiveAdmin::Page.

I could create the route manually of course, but would be great if the AA could handle this for us.

The documentation says nothing and the code is not so simple. :(

Any suggestion?

1

There are 1 best solutions below

5
Rodrigo On

You can use member_action:

ActiveAdmin.register Quiz do

  member_action :my_custom_page, method: :get do
  end

end

And this will generate a route at /admin/quizzes/:id/my_custom_page

Reference