Url_for and rake routes differences

I am caching and expiring pages/actions/fragments in my code and I’ve
come across a really frustrating problem

In my routes I have prefixed all controllers with the :locale. This
works well for the most part. When I cache a page/fragment it is
cached to /en/whatever etc… as expected

However when I try to expire the page/fragment the locale is not
prefixed to the url but added as an option ?locale=en (ie the
routes.rb directive is ignored)

I inserted a url_for statement into my controller to debug this issue
and I see the same behaviour.

As a result the cached code is not being expired.

I have no idea what I am doing wrong

Here is a pastie with all the code http://pastie.org/515309

Anyone have any ideas?

I inserted a url_for statement into my controller to debug this issue
and I see the same behaviour.

As a result the cached code is not being expired.

I have no idea what I am doing wrong

Here is a pastie with all the code http://pastie.org/515309

Anyone have any ideas?

Not an answer, but perhaps a clue…

Found in vendor/rails/railties/guides/source/i18n.textile is this line:

Every helper method dependent on +url_for+ (e.g. helpers for named
routes like
+root_path+ or +root_url+, resource routes like +books_path+ or
+books_url+,
etc.) will now automatically include the locale in the query string,
like
this: +http://localhost:3001/?locale=ja+.

-philip