URL structure ( example.com/~user/file )

Hi
I am new to Rails and have question. Maybe someone could help me with
this

I want to do something like this:
example.com/~user/file

where user is registered username, and then goes filename owned by
this user. So visiting this URL we can see uploaded file owned by
specific user. And if we visit example.com/~user - we can see list of
all files uploaded by this user.

Here is my solution for routes.rb
map.connect ‘:username/:file’, :controller =>
‘somecontroller’, :requirements => { :username => /~.*/ }

But I’m not sure if it is the best (correct?) way of doing this… I
would appreciate any help or advices.

Thanks

wbr, Vadim