Hi Nick and Chris, Thanks for the tips! As Nick says, it's more than just the single route, which is why what (Chris) you're suggesting doesn't quite get me there.
I did come across the "default routing" plugin (http://github.com/caring/default_routing) which purports to attach resources to /, but it didn't work for me. It put extra slashes in the routes. I patched it to generate proper URLs, but it still didn't seem to work quite right, and was requiring more and more patches. So, I'm just making all the routes by hand. It's starting to get ugly, but we'll see how it ends up. One issue is that the named routes are a mess. I'm starting to give up named routes. The benefit I get from the automagicness seems to be outweighed by the massive hackery I have to go through when the magic is wrong. Best, Erik On Sun, Oct 25, 2009 at 9:06 PM, Nick Zadrozny <[email protected]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---
