Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Action caching ignores format for XMLHttpRequest

#3069

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.

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

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Brad Sumersford
    Brad Sumersford

    I am experiencing this exact same issue.

    October 22nd, 2009 @ 09:52 PM

  2. Rohit Arondekar
    Rohit Arondekar
    • 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.

    October 6th, 2010 @ 06:37 AM