# Anyway to dry this up?

**URL:** <https://www.ruby-forum.com/t/anyway-to-dry-this-up/91276>\
**Category:** Rails\
**Created:** [April 6, 2007, 6:27am UTC](https://www.ruby-forum.com/t/anyway-to-dry-this-up/91276 "2007-04-06T06:27:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsanheim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/47e85d/32.png) [@rsanheim](https://www.ruby-forum.com/u/rsanheim)\
**Post date:** [April 6, 2007, 6:27am UTC](https://www.ruby-forum.com/t/anyway-to-dry-this-up/91276/1 "2007-04-06T06:27:23Z")

</div>

Is there a way to take this common route pattern:

map.category ‘/by/:type/:category’, :controller =\> ‘category’,  
:action =\> ‘show’, :page\_number =\> ‘1’  
map.connect ‘/by/:type/:category/page/:page\_number’, :controller =\>  
‘category’, :action =\> ‘show’, :page\_number =\> /\d+/

And do it with one line?

btw, this allows /by/type/people (for page 1, implicit), and  
/by/type/people/page/xx (for pages after 1).

- Rob  
–  
[http://robsanheim.com](http://robsanheim.com)  
[http://seekingalpha.com](http://seekingalpha.com)
