I have a resource called User and another one called Order.
I want Order to be nested inside Users so I can have these routes:
/users
/users/:id
/users/:id/new
/users/:id/edit
/users/:user_id/orders
/users/:user_id/orders/:id
/users/:user_id/orders/:id/new
/users/:user_id/orders/:id/edit
How can I do that with activeadmin?
Active Admin is a framework for creating administration style interfaces. It abstracts common business application patterns to make it simple for developers to implement beautiful and elegant interfaces with very little effort.
Just add belongs_to option to active_admin resource page
ActiveAdmin.register Order do
belongs_to :user
end
@railscard's answer is partially correct, but if you don't want the default routes like /order, /order/:id etc like mentioned by @bishma-stornelli - you could add the option like this :
ActiveAdmin.register Order do
belongs_to :user, :optional => true
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With