1

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 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

5 Comments

So obsviously... :P But do you know how to attach a Page instance to this member_action? Thanks!
This action will render the view under the path app/views/admin/quizzes/my_custom_page.html.erb
Yep! But could we have a Page instance instead? Thus we could take benefit of AA's dsl.
member_action does exactly what Page does, but related to a model. That is what you need, don't?
There are some features that couldn't be used when working with .erb (unless you include some modules).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.