This project is archived and is in readonly mode.

#3069 ✓stale
Tomas K.

Action caching ignores format for XMLHttpRequest

Reported by Tomas K. | August 19th, 2009 @ 02:49 AM

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.

Comments and changes to this ticket

  • Brad Sumersford

    Brad Sumersford October 22nd, 2009 @ 09:52 PM

    I am experiencing this exact same issue.

  • Rohit Arondekar

    Rohit Arondekar October 6th, 2010 @ 06:37 AM

    • State changed from “new” to “stale”
    • Importance changed from “” to “”

    Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages