andyl wrote in post #965181: > I have a Rails3 app with three resources: > - League (has_many :teams) > - Team (belongs_to :league, has_many :players) > - Player (belongs_to :team) > > With standard nested routes, I get URLs like: > > /leagues (lists all leagues) > /leagues/2 (shows league #2) > /leagues/2/teams (lists all teams in league #2) > /teams/1 (shows team #1) > /teams/1/players (lists all players in team #1) > /players/1 (shows player #1) > > I would like 'user friendly' urls like: > > /west_conference/ (shows league 'west_conference') > /west_conference/teams (lists all the teams in the west conference) > /west_conference/eagles (shows the team 'eagles') > /west_conference/eagles/players (lists all players on the eagles) > /west_conference/eagles/smith (shows the player 'smith') > > How do I configure my Rails3 app to add user_friendly urls like this?
There are several ways to do this. Most of them involve overriding to_param and/or installing a gem such as friendly_id or permalink_fu. Search the list archives for ideas; this comes up pretty frequently. > > tx, Andy Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.