Permalink
Browse files

Fix bug where action caching sets the content type to the ActionCache…

…Path object. Closes #9282 [mindforge]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7346 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent bba22ce commit 1a459e8e7d9f32e6c3a55153e8e1cfabef881839 @technoweenie technoweenie committed Aug 20, 2007
View
@@ -1,5 +1,7 @@
*SVN*
+* Fix bug where action caching sets the content type to the ActionCachePath object. Closes #9282 [mindforge]
+
* Find layouts even if they're not in the first view_paths directory. Closes #9258 [caio]
* Major improvement to the documentation for the options / select form helpers. Closes #9038 [kampers, jardeon, wesg]
@@ -231,7 +231,7 @@ def before(controller)
cache_path = ActionCachePath.new(controller, path_options_for(controller, @options))
if cache = controller.read_fragment(cache_path.path)
controller.rendered_action_cache = true
- set_content_type!(controller, cache_path)
+ set_content_type!(controller, cache_path.extension)
controller.send(:render_text, cache)
false
else
@@ -279,6 +279,11 @@ def test_xml_version_of_resource_is_treated_as_different_cache
assert_equal 'xml', path_object.extension
assert_equal 'example.org/posts/index.xml', path_object.path
end
+
+ def test_correct_content_type_is_returned_for_cache_hit
+ get :index, :id => 'content-type.xml'
+ assert_equal 'application/xml', @response.content_type
+ end
def test_empty_path_is_normalized
@mock_controller.mock_url_for = 'http://example.org/'

0 comments on commit 1a459e8

Please sign in to comment.