This is a bit of a head scratcher, I'm hoping some of the rails
magicians out there can help.

I've got a users controller, and users have usernames, and I want the
url for users to be just their username at the root of the tree.  So
...

/erik => {:controller => "users_controller", :action => "show", :id => "erik"}
/erik/edit => {:controller => "users_controller", :action => "edit",
:id => "erik"}

... and so-on.  But I can't figure out how to write the route for
this.  Obviously I could connect up every single action individually,
but there should be a way to do this with resources, no?  The closest
I can get is:

map.resources :users, :as => ''

... but that maps the erik user to //erik.  Not quite right.

Thanks for the help!  This one is driving me a little batty.  And
while I'm at it... can anyone recommend a good essay or book chapter
on routes, paths, and such?  It's still all a bit magical to me.

Erik

--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to