I have this route: map.item ''items/:id'', :controller=>''items'', :action=>''show'', :requirements => {:id => /\d+/} With this route the URL ''items'' without an id still gets routed to items#show. Isn''t requirements (or just :id=>/\d+/, which I''ve also tried) supposed to prevent that? I want plain ''items'' requests without an ID to use the default index action, which it does if this route isn''t defined. Joe -- 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 -~----------~----~----~----~------~----~------~--~---
Why not just defined a rule directly above it without :id? That''s what I do and it works fine... On 28/08/06, Joe Ruby <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I have this route: > > map.item ''items/:id'', :controller=>''items'', :action=>''show'', > :requirements => {:id => /\d+/} > > With this route the URL ''items'' without an id still gets routed to > items#show. Isn''t requirements (or just :id=>/\d+/, which I''ve also > tried) supposed to prevent that? I want plain ''items'' requests without > an ID to use the default index action, which it does if this route isn''t > defined. > > Joe > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Ian Leitch wrote:> Why not just defined a rule directly above it without :id? That''s what I > do > and it works fine...Yup, but that shouldn''t be necessary. Joe -- 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 -~----------~----~----~----~------~----~------~--~---