LoginSignup
0
0

More than 3 years have passed since last update.

【Ruby on Rails】 ルーティングのネスト (入れ子)

Posted at
TechReviewSite::Application.routes.draw do
  resources :products, only: :show do
    resources :reviews, only: [:new, :create]
    collection do
      get 'search'
    end
  end
  root 'products#index'

end
$ rake routes
product_reviews POST /products/:product_id/reviews(.:format)                                                  reviews#create
       new_product_review GET  /products/:product_id/reviews/new(.:format)                                              reviews#new

このように入れ子になっていることがわかります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0