(コードスクールのオンラインコース、ゼロからのレールアプリパート1の演習を行っています)
これが私のroutes.rb
resources :destinations, only: :index
resources :trips do
resources :destinations
end
そのrake routes
結果、次の 2 つのルートが同じアクションに移動します。
Prefix Verb URI Pattern Controller#Action
destinations GET /destinations(.:format) destinations#index
trip_destinations GET /trips/:trip_id/destinations(.:format) destinations#index
に一致させる、つまりにリダイレクトしたいのtrip_destinations
ですtrip#show
が/trips/:id
、ハードコードするroutes.rb
か、リダイレクトを追加するなどの解決策がありdestination#index
ます。どちらの方がよいですか?このタスクを達成するためのベスト プラクティスはありますか?