Routing parameters with a dot
Last week I received an interesting bug report for an application I’m working on at the office. It has a controller with an index action that displays a list of items which can be filtered by tags. A tester reported that every time he chooses to filter the list by a tag that contains a dot, the site returns an error. First this seems strange since tags with a dot worked perfectly fine in tests.
But after digging deeper, I found a surprising reason for this strange error: To make URLs look nicer, I defined an extra route like this:
1 map.things 'things/:tag', :controller => 'things', :action => 'index', 2 :tag => nil
The intention was, to have /things/foo instead of /things&tag=foo as the URL. This actually worked fine – except for cases when the tag contained a dot.
Latest comments