Wow, I sure have wasted a lot of time trying to get my named routes to work in Rails 1.2. Everything worked fine in 1.1. I''m ready to kill whoever rewrote the routing and broke BC. My routes: #map.item ''item/:id'', :controller=>''items'', :action=>''show'', :order=>nil, :requirements => {:id => /\d+/} map.item ''item/type/:type/category/:category_id'', :controller=>''items'', :action=>''show'', :category_id => /\d+/, :id => /\d+/ map.item ''item/type/:type/:id'', :controller=>''items'', :action=>''show'', :type=>/\w+/, :id => /\d+/ map.item ''item/category/:category_id'', :controller=>''items'', :action=>''show'', :category_id => /\d+/, :id => /\d+/ map.item ''item/:id'', :controller=>''items'', :action=>''show'', :id => /\d+/ #map.item ''item/:id/:order'', :controller=>''items'', :action=>''show'', :requirements => {:id => /\d+/} I either get an error like this: `raise_named_route_error'': item_url failed to generate from {:order=>"added", :id=>"88725", :action=>"show", :type=>"pictures", :controller=>"items"}, expected: {:action=>"show", :type=>nil, :controller=>"items"}, diff: {:order=>"added", :id=>"88725", :type=>nil} or generated URLs look like this: /item/12345?order=views&type=foo when they should look like this: /item/type/foo/12345 WTF? Joe Ruby MUDCRAP-CE -- 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 -~----------~----~----~----~------~----~------~--~---
> Wow, I sure have wasted a lot of time trying to get my named routes to > work in Rails 1.2. Everything worked fine in 1.1. I''m ready to kill > whoever rewrote the routing and broke BC. My routes:The first rule of free, technical support is that you''re asking for it, not entitled to it. Thus, you get further by asking nicely. You''re not asking very nicely, so you shouldn''t be surprised if you''re not getting a lot of help.> map.item ''item/type/:type/category/:category_id'', > :controller=>''items'', :action=>''show'', :category_id => /\d+/, :id => > /\d+/ > map.item ''item/type/:type/:id'', :controller=>''items'', :action=>''show'',You''re declaring multiple named routes with the same name. These will overwrite each other. There can only be one item_url method. Come up with different names, like map.type_category_item, map.type_item, etc.> WTF?Attitude is an expensive luxury and you''ve already maxed out all your good-will credit cards. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
DHH wrote:>> Wow, I sure have wasted a lot of time trying to get my named routes to >> work in Rails 1.2. Everything worked fine in 1.1. I''m ready to kill >> whoever rewrote the routing and broke BC. My routes: > > The first rule of free, technical support is that you''re asking for > it, not entitled to it. Thus, you get further by asking nicely. You''re > not asking very nicely, so you shouldn''t be surprised if you''re not > getting a lot of help. > >> map.item ''item/type/:type/category/:category_id'', >> :controller=>''items'', :action=>''show'', :category_id => /\d+/, :id => >> /\d+/ >> map.item ''item/type/:type/:id'', :controller=>''items'', :action=>''show'', > > You''re declaring multiple named routes with the same name. These will > overwrite each other. There can only be one item_url method. Come up > with different names, like map.type_category_item, map.type_item, etc.Wow, really?!? I can''t remember who/what told me it was possible to use multiple named routes of the same name (perhaps Jarkko I think). Well, that sucks it''s not possible! Anyhow, thanks for clueing me in!> >> WTF? > > Attitude is an expensive luxury and you''ve already maxed out all your > good-will credit cards.Hey, I''m MUDCRAP certified! Suck it! ;P Joe Ruby MUDCRAP-CE -- 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 -~----------~----~----~----~------~----~------~--~---
DHH wrote:>> map.item ''item/type/:type/category/:category_id'', >> :controller=>''items'', :action=>''show'', :category_id => /\d+/, :id => >> /\d+/ >> map.item ''item/type/:type/:id'', :controller=>''items'', :action=>''show'', > > You''re declaring multiple named routes with the same name. These will > overwrite each other. There can only be one item_url method. Come up > with different names, like map.type_category_item, map.type_item, etc.Seriously, DHH, thanks for pointing that out. You likely saved me additional hours of banging my head against the screen mistakenly believing that multiple named routes with the same name were possible (and why shouldn''t I since they worked before and the docs make no mention they''re not?). An error should probably result if there''s more than one named route with the same name. I was just venting, with tongue in cheek. ;P I''m used to the rougher treatment in Zed''s forum. ;P Cheers, Joe Ruby -- 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 -~----------~----~----~----~------~----~------~--~---