Rewriting url path element as parameter

Hi,

I'd like to rewrite the url:

http://myapp.mycompany.com/project_name/some_action/id?.

to

http://myapp.mycompany.com/some_action/id?.…&project=project_name

or map it somehow to the appropriate rails controller.

I'd prefer to do this without recourse to mod_rewrite, etc in the web
server and manage to handle this in my application. I couldn't see any
examples in my googling though I do recall that I have seen some
routes dynamically added within a rails application setup.

Any ideas or pointers to examples?

Thanks,

Allan