Possible to simplify these routes?


#1

In my routes.rb I have:

map.connect

‘items/category/:category_id/order/:order/page/:page’,
:controller=>‘item’,
:action=>‘list’,
:requirements => {:category_id => /\d+/}
map.connect
‘items/category/:category_id/order/:order’,
:controller=>‘item’,
:action=>‘list’,
:requirements => {:category_id => /\d+/}
map.connect ‘items/category/:category_id’,
:controller=>‘item’,
:action=>‘list’,
:requirements => {:category_id => /\d+/}
map.connect ‘items/order/:order/page/:page’,
:controller=>‘item’,
:action=>‘list’
map.connect ‘items/order/:order’,
:controller=>‘item’,
:action=>‘list’
map.connect ‘items/page/:page’,
:controller=>‘item’,
:action=>‘list’
map.connect ‘items’,
:controller=>‘item’,
:action=>‘list’

Yuck. Is it possible to simplify this? I tried adding
params like ‘:order=>nil’, but that caused the wrong
URLs to get generated in pagination_links.

thanks
csn


Yahoo! Mail - PC Magazine Editors’ Choice 2005
http://mail.yahoo.com