Home Play Pinja Bobbity flop

A blog about Ruby, Rails and other Tech. Mostly.

Back to blog

26th Feb 2007, 7:57am
Rails 1.2 breakage in routes

Rails 1.2 is almost, but not quite, backwards compatible with 1.1x. We suffered from route failures after upgrading.

There were two problems. Firstly, routes are now sensitive to "." characters. You can't have a route component with a dot in it any more - except if you explicitly match it.

We ended up using this kind of regex in the route parameters to match anything:

map.connect "foo/:name/:value", :name=>/[^\/]+/
This will now match requests like "/foo/blah_1..10/56"

Secondly, we were using anchors in some regexes - like:

map.connect "foo/:bar", :bar=>/^x_[0-9]/
You'll get an error "Regexp anchor characters are not allowed in routing requirements" if you do that.

This is because these regexes are now automatically anchored at the start and end of the path component. Just removing the anchors from your regex fixes it.


Back to blog