# Little routing question

**URL:** <https://www.ruby-forum.com/t/little-routing-question/159145>\
**Category:** Rails\
**Created:** [February 1, 2009, 11:24am UTC](https://www.ruby-forum.com/t/little-routing-question/159145 "2009-02-01T11:24:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tekhne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/90ced4/32.png) [@tekhne](https://www.ruby-forum.com/u/tekhne)\
**Post date:** [February 1, 2009, 11:24am UTC](https://www.ruby-forum.com/t/little-routing-question/159145/1 "2009-02-01T11:24:19Z")

</div>

Sorry if I am being dumb here but I am trying to route with this url ‘/  
media/avatars/1/5or6.png’ to the media controller with the avatars  
action

I tried this:

map.connect ‘media/avatars/:user\_id/:filename’, :controller =\>  
‘media’, :action =\> ‘avatars’

in my routes.rb file but I’m still getting (No route matches “/media/  
avatars/1/5or6.png” with {:method=\>:get})

Any pointers would be appreciated

---

<div class="post-metadata">

**Author:** ![tekhne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/90ced4/32.png) [@tekhne](https://www.ruby-forum.com/u/tekhne)\
**Post date:** [February 1, 2009, 12:08pm UTC](https://www.ruby-forum.com/t/little-routing-question/159145/2 "2009-02-01T12:08:19Z")

</div>

Ok it’s answer my own question time. What I needed was

map.connect ‘media/avatars/:id/:filename’,  
:controller =\> ‘media’,  
:action =\> ‘avatars’,  
:requirements =\> {  
:id =\> /\d+/,  
:filename =\> /\S+.\S+/  
}

Works fine now.
