If there is no format specified in url, a chosen template
differs for XMLHttpRequest (js is used)
and non-XMLHttpRequest (html is used). Cache fragment name is the
same for both request types.
If the cache fragment is created by normal (non-XMLHttpRequest)
request with no format specifier
(i.e. /books) and than the same page is accessed via
XMLHttpRequest, a cached fragment in html format will be returned
and the page would be probably broken. The same problem happens
when the
fragment is created by XMLHttpRequest and than the page is accessed
via non-XMLHttpRequest.
This code:
class BooksController < ApplicationController
caches_action :index
...
creates a cache fragment called
views/myserver/books.cache
I think fragment should have extension according to template
which was used:
views/myserver/books.html.cache
views/myserver/books.js.cache
I found this bug in Rails 2.2.2., Rails 2.3.3. and the Edge
Rails. A patch for Edge Rails is attached.