From dc629f5c07371af5a1f8f3e833e1f63ef71103b2 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Mon, 28 May 2007 12:48:42 -0500 Subject: [PATCH] Do Content-negotiation for Cached Content The action_cache plugin broke our content-negotiation. Fixed. --- app/controllers/application.rb | 4 ++++ vendor/plugins/action_cache/lib/action_cache.rb | 1 + 2 files changed, 5 insertions(+) diff --git a/app/controllers/application.rb b/app/controllers/application.rb index a44505a1..cb0bdc09 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -144,6 +144,8 @@ class ApplicationController < ActionController::Base end end + public + def set_content_type_header if %w(atom_with_content atom_with_headlines).include?(action_name) response.headers['Content-Type'] = 'application/atom+xml; charset=UTF-8' @@ -158,6 +160,8 @@ class ApplicationController < ActionController::Base end end + protected + def set_robots_metatag if controller_name == 'wiki' and %w(show published).include? action_name @robots_metatag_value = 'index,follow' diff --git a/vendor/plugins/action_cache/lib/action_cache.rb b/vendor/plugins/action_cache/lib/action_cache.rb index 4508f834..380f6285 100644 --- a/vendor/plugins/action_cache/lib/action_cache.rb +++ b/vendor/plugins/action_cache/lib/action_cache.rb @@ -141,6 +141,7 @@ module ActionController def send_cached_response(cache_entry, controller) controller.logger.info "Send #{body_name(controller)} by response.body" controller.response.headers = cache_entry.headers + controller.set_content_type_header controller.response.body = fragment_body(controller) end