Forum: Ruby on Rails Little routing question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0bfcd61fc289de2e441929ecfd00b0ed?d=identicon&s=25 Peter Hickman (Guest)
on 2009-02-01 11:24
(Received via mailing list)
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
0bfcd61fc289de2e441929ecfd00b0ed?d=identicon&s=25 Peter Hickman (Guest)
on 2009-02-01 12:08
(Received via mailing list)
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.
This topic is locked and can not be replied to.