ruby-on-railsroutesnamed-routing

Multiple parameters to named route rails 3


I have the following route:

match "sports/:sport(/:view)" => 'sports#show', as:'sport_path'

How do I call sport_path(sport, view)? When I try:

sport_path(params[:sport], 1)

The resulting url is: /sports/5.1. It should be /sports/5/1 (notice the dot instead of the slash)


Solution

  • I had another route named sport. face-palm