Theo B
Theo B

Reputation: 361

How to create a nested custom page in ActiveAdmin?

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?

Upvotes: 1

Views: 829

Answers (1)

Rodrigo
Rodrigo

Reputation: 4802

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

Upvotes: 2

Related Questions