This project is archived and is in readonly mode.

#6480 ✓committed
Cheah Chu Yeow

Action cache filter code incorrectly renders nil response body if response is non-cacheable

Reported by Cheah Chu Yeow | February 27th, 2011 @ 03:11 PM

Best explained with an example - consider the simple controller below:

class ActionCachingTestController < ActionController::Base
  caches_action :four_oh_four

  def four_oh_four
    render :text => "404'd!", :status => 404
  end
end

The four_oh_four action returns a HTTP 404 response, which is non-cacheable. The Action cache filter, however, has faulty code that causes the response to be nil (basically an empty page is returned).

I've attached a patch that fixes this by continuing to render the response body in cases where an action is non-cacheable.

Tested against Rails master @ f3e9cbc69.

Comments and changes to this ticket

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