RESTful routing: allowing .s [dots] in ids

I haven't tried it with a restful route, but I have a route like this:

     r.curriculum '/curriculum/:code/:title/:action',                   :defaults => { :action => 'overview' },                   :requirements => { :code => %r([\d.]+) }

:code is a float-like number. 11.123, etc. The above :requirements
part let's digits/dots through. Before I added that my memory is it
complained like you say.

Perhaps you can work that into the restful route somehow...

Philip Hallstrom wrote:

I haven't tried it with a restful route, but I have a route like this:

     r.curriculum '/curriculum/:code/:title/:action',                   :defaults => { :action => 'overview' },                   :requirements => { :code => %r([\d.]+) }

:code is a float-like number. 11.123, etc. The above :requirements part let's digits/dots through. Before I added that my memory is it complained like you say.

Perhaps you can work that into the restful route somehow...

Thanks Philip, I tried this tack but it doesn't work with a url where the id is at the end. If we have a path like:

/curriculum/12.1

the routing can't distinguish between id 12 with a format of 1 and an id of 12.1. This is compounded by the fact that my API clients need to be able to tack .xml on to the end of urls when they need an xml representation.

:frowning: