How to make routes that mimi Flickr's URLs

I have two resources, :users and :photos. Users is based on AuthLogic.
Photos has a type set to private or public. I would like configure my
routes to mimic the Flickr URL structure.

The routes I want are:

foo.com/photos = controller => photos, action => index,

This route will display the last n photos across all Users

foo.com/steve/photos where steve is a Users login = ???

Not sure how to do with this route. It looks like a nested route,
but I don't want "foo.com/users/steve/photos"
Its also not the user id, but the user login.

If the user is logged in, this route will display all the user's

photos.
If the user is not logged in, it will display their public photos.

foo.com/steve/photos/id where id is Photo id = ???

Again, don't know what route should be. Again, looks like a nested

route
above, but without the “users” in the path.

If the user is logged in, it will display the specified photo.
If the user is not logged in, it will display the photo if it is

public.

Any suggestions would be appreciated.

  • Steve W.