Nested scaffold

Last update in 3/2020

Scaffolds are used in Rails to generate CRUD API.

rails generate scaffold user name:string

This example creates returns all users at /users, one user at /users/:id...

If you want to create them with /admin prefix there are 2 options.

1. Namespace #

rails generate scaffold admin/user name:string

Note that this creates table admin_users which may not be desirable.

2. Scope #

Open config/routes.rb

scope '/admin' do
resources :users