hi i have rewritten my map.resources so that a resource is called from the start: map.connect '''', :controller => "resource" so www.mysite.com lists the available resource however i want www.mysite.com/1 to show one of a particular resource rather than www.mysite.com/show/1 as is the default restful route. how can i get this url? thanks --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Mahemoff
2007-Jul-06 20:19 UTC
Re: routing a restful controller to work from site root
Marc Rice wrote:> hi i have rewritten my map.resources so that a resource is called from > the start: map.connect '''', :controller => "resource" > > so www.mysite.com lists the available resource > > however i want www.mysite.com/1 to show one of a particular resource > rather than www.mysite.com/show/1 as is the default restful route. > > how can i get this url? >map.connect '':id'', :controller => "resources", :action=>"show" -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
this is great but what about with nested resources? thanks On Jul 6, 9:19 pm, Michael Mahemoff <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Marc Rice wrote: > > hi i have rewritten my map.resources so that a resource is called from > > the start: map.connect '''', :controller => "resource" > > > sowww.mysite.comlists the available resource > > > however i wantwww.mysite.com/1to show one of a particular resource > > rather thanwww.mysite.com/show/1as is the default restful route. > > > how can i get this url? > > map.connect '':id'', :controller => "resources", :action=>"show" > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Robert Walker
2007-Jul-07 07:12 UTC
Re: routing a restful controller to work from site root
A few things in you post don''t make sense to me... 1. You say that www.mysite.com/show/1 is a "RESTful route," but it''s not. RESTful routes don''t include the action (show) in this case. Say if your resource/model was Post then the RESTful URL would look something like www.mysite.com/posts/1. Notice there''s no mention of the action. The action is based on the HTTP verb used to access the URL. Show would be a GET request, POST to create, PUT to update, DELETE to destroy. 2. If you are using RESTful routes you would use map.resources not map.connect to declare your resources, which in turn creates the RESTful URLs. 3. If what you really mean is that you want to drop the resource out of the URL, which I must assume your application has only one main resource and everything else in the database is nested, then you would need to use map.connect or a named route to do that. On Jul 6, 4:07 pm, libsfan01 <mcyi2...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> hi i have rewritten my map.resources so that a resource is called from > the start: map.connect '''', :controller => "resource" > > sowww.mysite.comlists the available resource > > however i wantwww.mysite.com/1to show one of a particular resource > rather thanwww.mysite.com/show/1as is the default restful route. > > how can i get this url? > > thanks--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---