Reputation: 2569
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?
Upvotes: 17
Views: 9168
Reputation: 427
@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
Upvotes: 13
Reputation: 1848
Just add belongs_to option to active_admin resource page
ActiveAdmin.register Order do
belongs_to :user
end
Upvotes: 21