So far my routes.rb file looks something like this:
resources :games do
resources :planets do
member do
get 'index' as: :play_game
end
end
end
which creates these (when I check rake routes)
play_game_game_planet GET /games/:game_id/planets/:id/index(.:format) planets#index
game_planets GET /games/:game_id/planets(.:format) planets#index
POST /games/:game_id/planets(.:format) planets#create
new_game_planet GET /games/:game_id/planets/new(.:format) planets#new
edit_game_planet GET /games/:game_id/planets/:id/edit(.:format) planets#edit
game_planet GET /games/:game_id/planets/:id(.:format) planets#show
PATCH /games/:game_id/planets/:id(.:format) planets#update
PUT /games/:game_id/planets/:id(.:format) planets#update
DELETE /games/:game_id/planets/:id(.:format) planets#destroy
but the path I want is (similar to the second line)
play_game GET /games/:game_id/planets(.:format) planets#index