<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer">85</assigned-user-id>
  <attachments-count type="integer">1</attachments-count>
  <closed type="boolean">false</closed>
  <created-at type="datetime">2008-10-21T19:15:07+01:00</created-at>
  <creator-id type="integer">17222</creator-id>
  <milestone-due-on type="datetime" nil="true"></milestone-due-on>
  <milestone-id type="integer">9903</milestone-id>
  <number type="integer">1244</number>
  <permalink>caches_page-does-not-respect-accept-header</permalink>
  <priority type="integer">649</priority>
  <project-id type="integer">8994</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>new</state>
  <tag>cache caches_page caching format patch respond_to</tag>
  <title>caches_page does not respect Accept header</title>
  <updated-at type="datetime">2009-05-30T23:47:37+01:00</updated-at>
  <user-id type="integer">51923</user-id>
  <user-name>Andrew Bloomgarden</user-name>
  <creator-name>Mike Burns</creator-name>
  <assigned-user-name>Jeremy Kemper</assigned-user-name>
  <url>http://rails.lighthouseapp.com/projects/8994/tickets/1244</url>
  <milestone-title>2.x</milestone-title>
  <original-body>This little snippet in our JobsController was causing an issue:

 caches_page :index, :if =&gt; Proc.new {|c| c.request.format.xml?}

When requested as /jobs.xml it would create the file public/jobs.xml . However, when requested as /jobs with a header of 'Accept: text/xml' it would render the XML but cache to public/jobs.html . This meant GET /jobs.html would now produce XML.

Attached is a patch with tests and a possible solution to the problem.</original-body>
  <latest-body>This little snippet in our JobsController was causing an issue:

 caches_page :index, :if =&gt; Proc.new {|c| c.request.format.xml?}

When requested as /jobs.xml it would create the file public/jobs.xml . However, when requested as /jobs with a header of 'Accept: text/xml' it would render the XML but cache to public/jobs.html . This meant GET /jobs.html would now produce XML.

Attached is a patch with tests and a possible solution to the problem.</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;This little snippet in our JobsController was causing an
issue:&lt;/p&gt;
&lt;p&gt;caches_page :index, :if =&amp;gt; Proc.new {|c|
c.request.format.xml?}&lt;/p&gt;
&lt;p&gt;When requested as /jobs.xml it would create the file
public/jobs.xml . However, when requested as /jobs with a header of
'Accept: text/xml' it would render the XML but cache to
public/jobs.html . This meant GET /jobs.html would now produce
XML.&lt;/p&gt;
&lt;p&gt;Attached is a patch with tests and a possible solution to the
problem.&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>This little snippet in our JobsController was causing an issue:

 caches_page :index, :if =&gt; Proc.new {|c| c.request.format.xml?}

When requested as /jobs.xml it would create the file public/jobs.xml . However, when requested as /jobs with a header of 'Accept: text/xml' it would render the XML but cache to public/jobs.html . This meant GET /jobs.html would now produce XML.

Attached is a patch with tests and a possible solution to the problem.</body>
      <body-html>&lt;div&gt;&lt;p&gt;This little snippet in our JobsController was causing an
issue:&lt;/p&gt;
&lt;p&gt;caches_page :index, :if =&amp;gt; Proc.new {|c|
c.request.format.xml?}&lt;/p&gt;
&lt;p&gt;When requested as /jobs.xml it would create the file
public/jobs.xml . However, when requested as /jobs with a header of
'Accept: text/xml' it would render the XML but cache to
public/jobs.html . This meant GET /jobs.html would now produce
XML.&lt;/p&gt;
&lt;p&gt;Attached is a patch with tests and a possible solution to the
problem.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-10-21T19:15:07+01:00</created-at>
      <creator-id type="integer">17222</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1244</number>
      <permalink>caches_page-does-not-respect-accept-header</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>cache caches_page caching format respond_to</tag>
      <title>caches_page does not respect Accept header</title>
      <updated-at type="datetime">2008-10-21T19:15:13+01:00</updated-at>
      <user-id type="integer">17222</user-id>
      <user-name>Mike Burns</user-name>
      <creator-name>Mike Burns</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1244</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-03-10T11:18:10+00:00</created-at>
      <creator-id type="integer">17222</creator-id>
      <diffable-attributes type="yaml">--- 
:tag: cache caches_page caching format respond_to
:assigned_user: 
</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1244</number>
      <permalink>caches_page-does-not-respect-accept-header</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>cache caches_page caching format patch respond_to</tag>
      <title>caches_page does not respect Accept header</title>
      <updated-at type="datetime">2009-03-10T11:18:16+00:00</updated-at>
      <user-id type="integer">1366</user-id>
      <user-name>Pratik</user-name>
      <creator-name>Mike Burns</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1244</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>+1

We're encountering this problem on Rails 2.3. I'd like to fix it temporarily with an around_filter, but since caching happens after that I can't. Fixing it with a before_filter will change the type forever in production.</body>
      <body-html>&lt;div&gt;&lt;p&gt;+1&lt;/p&gt;
&lt;p&gt;We're encountering this problem on Rails 2.3. I'd like to fix it
temporarily with an around_filter, but since caching happens after
that I can't. Fixing it with a before_filter will change the type
forever in production.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-05-30T23:47:32+01:00</created-at>
      <creator-id type="integer">17222</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1244</number>
      <permalink>caches_page-does-not-respect-accept-header</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>cache caches_page caching format patch respond_to</tag>
      <title>caches_page does not respect Accept header</title>
      <updated-at type="datetime">2009-05-30T23:47:37+01:00</updated-at>
      <user-id type="integer">51923</user-id>
      <user-name>Andrew Bloomgarden</user-name>
      <creator-name>Mike Burns</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1244</url>
      <milestone-title>2.x</milestone-title>
    </version>
  </versions>
  <attachments type="array">
    <attachment type="Attachment">
      <code>8d236759c4f9fd9b1db4560ea67627b83f201f2e</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2008-10-21T19:15:07+01:00</created-at>
      <filename>caching-extension.patch</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">55823</id>
      <size type="integer">4578</size>
      <uploader-id type="integer">17222</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://rails.lighthouseapp.com/attachments/55823/caching-extension.patch</url>
    </attachment>
  </attachments>
</ticket>
