When searching for a path name, I usually use rails routes at the terminal,
               Prefix Verb   URI Pattern                                                                              Controller#Action
    new_admin_session GET    /admins/sign_in(.:format)                                                                admins/sessions#new
        admin_session POST   /admins/sign_in(.:format)                                                                admins/sessions#create
destroy_admin_session DELETE /admins/sign_out(.:format)                                                               admins/sessions#destroy
Find the path name from the prefix.
However, there are cases where the path name is not written like this.
               Prefix Verb   URI Pattern                                                                              
         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
                 cart GET    /carts/:id(.:format)                                                                     carts#show
The path name for products # destroy and products # update cannot be found. In this case, the path name will be product_path. You can go up until the path name appears in the prefix.
Recommended Posts