if I have the following in my routes.rb: map.resources :product_categories it provides urls such as: /product_categories /product_categories/1 /product_categories/1;edit etc. and uses the ProductCategories controller. how can I keep the same controller (and model) but set up the resources so that I can have any abitrary url point to the existing controller, much like specifying the controller with the old style routes? -felix --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
with RESTful routes if I place the following in routes.rb: map.resources :messages I get the following urls: /messages /messages/1 /messages/1;edit etc... and they all use the Messages controller Is it possible to still use the same controller but to change the url much like the old routes: map.connect ''/blah/:action/:id'', :controller => ''messages'' This allows me to have an abitrary url for any controller -felix --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
with the old routing you used to be able to specify an abitrary route for any controller like so: map.connect "blah/:action/:id", :controller => ''foo'' how can i do this with the new RESTful resources?? -felix --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 11/17/06, felix <felix.mccoey-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > with the old routing you used to be able to specify an abitrary route > for any controller like so: > > map.connect "blah/:action/:id", :controller => ''foo'' > > how can i do this with the new RESTful resources?? > > -felixYou can mix old and new routes together. -- Rick Olson http://weblog.techno-weenie.net http://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---
I know I can have them both but I have some nested routes and the url is becoming a little long. what i wanted to do is ''alias'' some of the sections on the url so that the result is much shorter. an example: /product_categories/3/products becomes /cat/3/products these are short examples but there are longer urls because of my model naming. thanks for you suggestions. -felix On Nov 17, 8:51 pm, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 11/17/06, felix <felix.mcc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > with the old routing you used to be able to specify an abitrary route > > for any controller like so: > > > map.connect "blah/:action/:id", :controller => ''foo'' > > > how can i do this with the new RESTful resources?? > > > -felixYou can mix old and new routes together. > > -- > Rick Olsonhttp://weblog.techno-weenie.nethttp://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---
On 11/17/06, felix <felix.mccoey-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I know I can have them both but I have some nested routes and the url > is becoming a little long. what i wanted to do is ''alias'' some of the > sections on the url so that the result is much shorter. > > an example: > > /product_categories/3/products > > becomes > > /cat/3/products > > these are short examples but there are longer urls because of my model > naming. > > thanks for you suggestions.Try this? map.resources :cats, :controller_name => ''product_categories do |cats| map.resources :products end -- Rick Olson http://weblog.techno-weenie.net http://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---
It looks to me like your trying to mingle the old style urls with the new RESTful urls. I don''t see the point. If you just want the old style, use those rather than RESTful style. On Nov 17, 2006, at 8:30 AM, felix wrote:> > with RESTful routes if I place the following in routes.rb: > > map.resources :messages > > I get the following urls: > > /messages > /messages/1 > /messages/1;edit > etc... > > and they all use the Messages controller > > Is it possible to still use the same controller but to change the url > much like the old routes: > > map.connect ''/blah/:action/:id'', :controller => ''messages'' > > This allows me to have an abitrary url for any controller > > -felix > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---