Another routing question


#1

I have a route similar to

map.connect ‘images/:action/:image’, :controller => ‘images’,
:requirements => { :image => /^.*.gif$/ }

The :image should always be a number appended with .gif (I realise the
regex doesn’t reflect this currently). I’d like to extract the numeric
part of the image filename to be used as :id. I can do this easily
within the controller but wonder if it’s even possible within the
routing.

To reduce the problem slightly, I’d basically like to be able to create
a route similar to…

map.connect ‘images/:action/:image’, :controller => ‘images’, :alt_image
=> :image

…where :alt_image gets the content of the :image part of the url.

I just did some digging into the routing and notice that map.connect
actually returns me a component. I was wondering if I could amend this
object, although I don’t think that would be great.

Are there any ways currently of achieving what I need or, indeed, any
obvious reasons why I shouldn’t even be thinking about it?

Chris