# Rails routes with prefix before the :id

**URL:** <https://www.ruby-forum.com/t/rails-routes-with-prefix-before-the-id/167428>\
**Category:** Rails\
**Created:** [May 7, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/rails-routes-with-prefix-before-the-id/167428 "2009-05-07T18:33:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sharcho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@Sharcho](https://www.ruby-forum.com/u/Sharcho)\
**Post date:** [May 7, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/rails-routes-with-prefix-before-the-id/167428/1 "2009-05-07T18:33:01Z")

</div>

This works:  
map.connect ‘/bananas/pdf/file/:id.pdf’, :controller =\>  
‘bananas’, :action =\> ‘pdf’

This doesn’t work:  
map.connect ‘/bananas/pdf/file\_:id.pdf’, :controller =\>  
‘bananas’, :action =\> ‘pdf’

So once I change the slash to underscore the route doesn’t work the  
way I expect it to.  
Is there some way I need to escape the routes to make them work (Rails  
2.1.2)?
