Home Play Pinja Bobbity flop

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

Back to blog

14th Mar 2007, 7:33am
More breakage in Rails 1.2 - routing and caching

We came across at least 5 issues in Rails 1.2 that affected our sites to do with routing / url_for and caching.

We do have a complicated routing and caching setup, and some things like the use of dots in urls has caused problems due to rails developing the ability to recognise .xml or .rss or whatever at the end of a url.

Anyway, here goes - 5 bugs reported:

  1. Putting slash in front of the controller name does not cause recalled options to be ignored
  2. Action caching only stores in one path even if there are multiple paths to an action.
  3. Action cache generates incorrect path if there is a dot in the url
  4. Cached items that have a dot in the path are served with the wrong content-type
  5. Params get ignored in url options if the same param names exist in the incoming params

I made a demo page for them also.

We have been able to work around these bugs for now - in particular we find is we put our routes in a particular order (the most complicated longer ones first) then correct paths are generated by url_for, and caching works.

Also by calling ActionController::Caching::Actions::ActionCachePath.path_for(controller) you can find the exact path used to cache something, and that helps in debugging or in keeping a list of cached pages in case you need to expire them.

Finally, if you use query strings and the params are not appearing in generated urls, then make a route including those params - that works.


Back to blog