Dynamic Routing

I need to do some dynamic routing in my application. It's a CMS type-application, so it needs to allow for users to create their own pages.

Heres what I was doing before: # config/routes.rb

map.connect "*path", :controller => "user_pages", :action => "show"

The show action would then take params[:path] and find the correct page. That was working great, until I had to enable the users to be able to create sub-pages on already existing controller routes. For example, I've got a:

map.resources :photos

in my routes config, which maps to a photos_controller.rb with all the normal CRUD translated actions. However, the user is supposed to be able to create custom pages in the same /photos URL. For example: example.com/photos/family

So I need something in the routes that tells rails to take a path like /photos and route it to the photos_controller like normal, but to take a route like /photos/family and route it to the user_pages controller.

I've been trying to use the :requirements parameter along with the *pages in the routing but that is failing miserably. Anyone have any suggestions for me? Thanks for listening.