Ruby on Rails Routing URL params with a period


Example

If you want to support a url parameter more complex than an id number, you may run into trouble with the parser if the value contains a period. Anything following a period will be assumed to be a format (i.e. json, xml).

You can work around this limitation by using a constraint to broaden the accepted input.

For example, if you want to reference a user record by email address in the url:

resources :users, constraints: { id: /.*/ }