Red > Green > Refactor > Red

cycle is based on desire

Rails routing ; resources nest

入れ子の resources

細かいかもしれないが

Sampleapp::Application.routes.draw do
  resources :users do
    resources :session, :task
  end
end

初めの nesting

resources :session, :task

これは、結果的に

resources :session

resources :task

としたことに変わりない。

開発標準を決めるときの指標にはなり得るかも

Sampleapp::Application.routes.draw do
  resources :products do
    resources :session, :task
  end 
end
               Prefix Verb   URI Pattern                                      Controller#Action
product_session_index GET    /products/:product_id/session(.:format)          session#index
                      POST   /products/:product_id/session(.:format)          session#create
  new_product_session GET    /products/:product_id/session/new(.:format)      session#new
 edit_product_session GET    /products/:product_id/session/:id/edit(.:format) session#edit
      product_session GET    /products/:product_id/session/:id(.:format)      session#show
                      PATCH  /products/:product_id/session/:id(.:format)      session#update
                      PUT    /products/:product_id/session/:id(.:format)      session#update
                      DELETE /products/:product_id/session/:id(.:format)      session#destroy
   product_task_index GET    /products/:product_id/task(.:format)             task#index
                      POST   /products/:product_id/task(.:format)             task#create
     new_product_task GET    /products/:product_id/task/new(.:format)         task#new
    edit_product_task GET    /products/:product_id/task/:id/edit(.:format)    task#edit
         product_task GET    /products/:product_id/task/:id(.:format)         task#show
                      PATCH  /products/:product_id/task/:id(.:format)         task#update
                      PUT    /products/:product_id/task/:id(.:format)         task#update
                      DELETE /products/:product_id/task/:id(.:format)         task#destroy
             products GET    /products(.:format)                              products#index
                      POST   /products(.:format)                              products#create
          new_product GET    /products/new(.:format)                          products#new
         edit_product GET    /products/:id/edit(.:format)                     products#edit
              product GET    /products/:id(.:format)                          products#show
                      PATCH  /products/:id(.:format)                          products#update
                      PUT    /products/:id(.:format)                          products#update
                      DELETE /products/:id(.:format)                          products#destroy