# Abbreviating routes when :format is presented

**URL:** <https://www.ruby-forum.com/t/abbreviating-routes-when-format-is-presented/127061>\
**Category:** Rails\
**Created:** [January 24, 2008, 5:22pm UTC](https://www.ruby-forum.com/t/abbreviating-routes-when-format-is-presented/127061 "2008-01-24T17:22:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![damaris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@damaris](https://www.ruby-forum.com/u/damaris)\
**Post date:** [January 24, 2008, 5:22pm UTC](https://www.ruby-forum.com/t/abbreviating-routes-when-format-is-presented/127061/1 "2008-01-24T17:22:18Z")

</div>

Hi you all,

I have some routes like the following, one for a possible HTML route,  
and the others when a :format parameter is presented, like .xml:

map.bugs\_by “bugs/by/:att/:value”, :controller =\> “bugs”,  
:action =\> “by”,  
:att =\> nil, :value =\>nil

map.connect “bugs/by.:format”, :controller =\> “bugs”, :action =\> “by”  
map.connect “bugs/by/:att.:format”, :controller =\> “bugs”, :action =\>  
“by”  
map.connect “bugs/by/:att/:value.:format”, :controller =\> “bugs”,  
:action =\> “by”

Is there a simple way to define the routes when :format is presented and  
the other parameters can be nil? Cause if not, routes.rb file can be a  
bit large.
