Wednesday, November 10, 2010

[Rails] Routes Refactoring

I have a simple rails3 app that has three nested resources:

Team has_many Groups
Group has_many Tools

To build the app quickly, I used standard restful practices, giving
URL's like:

/teams/1
/teams/1/groups
/groups/1
/groups/1/tools
/tools/1

Now I'd like to make the URL's more readable:

/<team_name>
/<team_name>/<group_name>
/<team_name>/<group_name>/<tool_name>

How should I set up my routes file to make this change?
Can the same controllers handle both route schemes?

Thanks, 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@googlegroups.com.
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate