From 2ee55557440a644453482a678e4ff08a4b5ebd3e Mon Sep 17 00:00:00 2001 From: Cheah Chu Yeow Date: Sun, 27 Feb 2011 22:57:46 +0800 Subject: Fix Action caching bug where an action that has a non-cacheable response always renders a nil response body. It now correctly renders the response body. Note that only GET and HTTP 200 responses can be cached. [#6480 state:committed] Signed-off-by: Santiago Pastorino --- actionpack/lib/action_controller/caching/actions.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index a4bac3caed..a1c582560c 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -103,12 +103,14 @@ module ActionController #:nodoc: end def _save_fragment(name, options) - return unless caching_allowed? - content = response_body content = content.join if content.is_a?(Array) - write_fragment(name, content, options) + if caching_allowed? + write_fragment(name, content, options) + else + content + end end protected -- cgit v1.2.3