I will describe the difference between member and collection when setting the routing in routes.rb of rails.
routes.rb
resources :buy_additional_actions, only: %i[] do
member do
get 'index' => 'buy_additional_actions#index'
In the case of menber,: id is automatically added to the generated url.
buy_additional_action GET /buy_additional_actions/:id/index(.:format) buy_additional_actions#index
routes.rb
resources :buy_additional_actions, only: %i[] do
collection do
get 'index' => 'buy_additional_actions#index'
In the case of collection,: id is not added to url.
buy_additional_actions GET /buy_additional_actions/index(.:format) buy_additional_actions#index
Recommended Posts