Rails friendly URL routing with public id

I would like to use rails route creation for public user id. The url would look like

http://mysite.com/identity/:html_encoded_openid
or
http://mysite.com/identity/:html_encoded_openid.xml

      

This will be so that the site can query for a public identifier and either view information for that identifier, or get an XML document containing that information. Standard Rails stuff.

I am looking for your experience on several things:

And I would rather not use the standard friendly url method:

my-friendly-openid-com
or
23-my-friendly-openid-com

      

if it is possible.

+1


source to share


1 answer


You can handle this second route with something like this (replace the action name with something real).



map.connect 'identity/:id', :controller => "identity", 
                            :action => "foo", 
                            :requirements => {:id => /(\w+\.?)+/}

      

+1


source







All Articles