And I may have clicked send too soon, because that doesn't really answer the
core of your question.
To be honest, if you really want to be explicit and map each of the actions,
I say go ahead and do it manually. I'm going to assume that, since this is
in the root of the URL path, this is the only controller that will be
handled in this way. In which case, no big deal expanding that out.
map.user ":id", :controller => "users", :action => "show", :conditions => {
:method => :get }
map.user ":id", :controller => "users", :action => "update", :conditions =>
{ :method => :put }
map.user ":id", :controller => "users", :action => "destroy", :conditions =>
{ :method => :delete }
map.user ":id/edit", :controller => "users", :action => "edit", :conditions
=> { :method => :get }
Now, I left off the index, create and new actions here. They're the ones
that give me pause. Do you really want to put each action in the root of
your URL namespace? If so, cool, go for it. However, what I suspect might
work equally well is to simply override the "show" case.
map.resources :users
map.user ":id", :controller => "users", :action => "show"
I think (but have not recently tested, so do some experimenting) that this
should override the user_path helper method and generally redirect you to
"/whomever" where appropriate, while still using the "/users" prefix for
other actions. At any rate, I seem to recall having done something similar
with an older project of mine, so it may serve as an idea worth pursuing for
your app.
I hope that's a bit more helpful!
--
Nick Zadrozny
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---