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 R. MUDCRAP-CE