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? tx, Andy -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Nov 30, 2010 at 11:26 AM, andyl <akleak-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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?Aside from a bit of manual routing, have you seen friendly_id?> tx, Andy > > -- > 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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, AndyBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.