You already have the game_planets /games/:game_id/planets(.:format) planets#index
route defined above -- the named route for which is game_planets
. So I assume what you're wanting is a different name for the named route?
If that's what you're after and you can't be advised otherwise (i.e. other Rails developers looking at this would wonder why the non-standard named route structure) then you can do this:
resources :games do
resources :planets
end
get 'games/:game_id/planets', 'planets#index', as: 'play_game'
This essentially creates a duplicate route with a special named route. But I'd recommend against this because:
- Index actions should use a plural named route (so at least use
as: 'play_games'
) - It's not standard. The named route
play_game
would make me think there was aPlayController
that had a nestedGame
controller and that this would be ashow
action requiring aplay
object passed into it.