I don''t have edge rails installed, otherwise I would just test it out. But in Rails 2.0 they are doing away with the semi-colon for several reasons. I think this is great, but it brings an interesting issue to the forefront that''s actually bothered me in 1.2 as well... How will Rails differentiate between an action on the collection and the id? For instance, if you have: map.resources :listings, :collection => {:search => :get} listings/1 listings/search (in 1.2 t it would be listings;search) Interestingly this problem existed before if you tried to mix default routing with RESTful routes which you might want to do for aesthetic or hackish reasons. --~--~---------~--~----~------------~-------~--~----~ 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 is my understanding that most are recommending removing the default routes when using RESTful Rails. # Resources routes map.resources :listings, :collection => {:search => :get} # Install the default route as the lowest priority. # map.connect '':controller/:action/:id.:format'' # map.connect '':controller/:action/:id'' But other than that, the same precedence is used in following routes as before. On May 23, 3:08 pm, dasil003 <gabrie...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I don''t have edge rails installed, otherwise I would just test it > out. But in Rails 2.0 they are doing away with the semi-colon for > several reasons. I think this is great, but it brings an interesting > issue to the forefront that''s actually bothered me in 1.2 as well... > > How will Rails differentiate between an action on the collection and > the id? For instance, if you have: > > map.resources :listings, :collection => {:search => :get} > > listings/1 > listings/search (in 1.2 t it would be listings;search) > > Interestingly this problem existed before if you tried to mix default > routing with RESTful routes which you might want to do for aesthetic > or hackish reasons.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Well that makes sense for the current version, but the point is that this conflict exists entirely within RESTful routes as of Rails 2.0. They must have done something to work around it. LIke maybe change the default member get to use singular form (ie. listing/1 instead of listings/1). Anyone have any idea? PS. WTF is up with Google Groups? Dropped messages all over the place, weird error messages, etc. This thread was empty in Google Groups so I had to come to ruby-forum. Robert Walker wrote:> It is my understanding that most are recommending removing the default > routes when using RESTful Rails. > > # Resources routes > map.resources :listings, :collection => {:search => :get} > > # Install the default route as the lowest priority. > # map.connect '':controller/:action/:id.:format'' > # map.connect '':controller/:action/:id'' > > But other than that, the same precedence is used in following routes > as before.-- 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 -~----------~----~----~----~------~----~------~--~---
Hey, sorry if I''ve misinterpreted what you''re saying - but you''re speculating about a problem that (again, if I understand you correctly) does not exist. The resources code (see resources.rb) adds collection routes before member routes - which means collection routes will take precedence during recognition. HTH, Trevor On 5/23/07, Gabe Da silveira <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Well that makes sense for the current version, but the point is that > this conflict exists entirely within RESTful routes as of Rails 2.0. > They must have done something to work around it. LIke maybe change the > default member get to use singular form (ie. listing/1 instead of > listings/1). Anyone have any idea? > > PS. WTF is up with Google Groups? Dropped messages all over the place, > weird error messages, etc. This thread was empty in Google Groups so I > had to come to ruby-forum. > > Robert Walker wrote: > > It is my understanding that most are recommending removing the default > > routes when using RESTful Rails. > > > > # Resources routes > > map.resources :listings, :collection => {:search => :get} > > > > # Install the default route as the lowest priority. > > # map.connect '':controller/:action/:id.:format'' > > # map.connect '':controller/:action/:id'' > > > > But other than that, the same precedence is used in following routes > > as before. > > > -- > Posted via http://www.ruby-forum.com/. > > > >-- -- Trevor Squires http://somethinglearned.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 -~----------~----~----~----~------~----~------~--~---
> Interestingly this problem existed before if you tried to mix default > routing with RESTful routes which you might want to do for aesthetic > or hackish reasons.Put your restful routes above your default routes. I actually remove my default ones altogether. -- Rick Olson http://lighthouseapp.com 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 -~----------~----~----~----~------~----~------~--~---
Jean-Etienne Durand
2007-May-24 17:29 UTC
Re: Rails 2.0 RESTful Routes action/id dichotomy
But still, if you use smart urls, you can never know if in /people/whatever whatever is an action, or an ID... -- 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 -~----------~----~----~----~------~----~------~--~---
Right, that''s the scenario I was thinking of. But I guess as long as you make sure your URL slugs never conflict with an action you''ll be okay. Jean-Etienne Durand wrote:> But still, if you use smart urls, you can never know if in > /people/whatever whatever is an action, or an ID...-- 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 -~----------~----~----~----~------~----~------~--~---
> Right, that''s the scenario I was thinking of. But I guess as long as > you make sure your URL slugs never conflict with an action you''ll be > okay. > > Jean-Etienne Durand wrote: > > But still, if you use smart urls, you can never know if in > > /people/whatever whatever is an action, or an ID...Custom actions are defined explicitly, so you do know. Anything that''s defined explicitly is not an id. Usually, ids are in another class entirely anyway. Like they''re purely integers or they follow a stand form of perhaps 1-my-title. So there''s not even any logical overlap. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---