简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM