diff options
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/components_test.rb | 11 |
3 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index ef28e1b7bb..dd354d886c 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Don't prepare response when rendering a component. #8493 [jsierles] + * Reduce file stat calls when checking for template changes. #7736 [alex] * Added custom path cache_page/expire_page parameters in addition to the options hashes [DHH]. Example: diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 8bff41d38d..883a671270 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -496,7 +496,7 @@ module ActionController #:nodoc: assign_default_content_type_and_charset response.request = request - response.prepare! + response.prepare! unless component_request? response ensure process_cleanup diff --git a/actionpack/test/controller/components_test.rb b/actionpack/test/controller/components_test.rb index 81f1d17ea9..c45a59bdbe 100644 --- a/actionpack/test/controller/components_test.rb +++ b/actionpack/test/controller/components_test.rb @@ -96,6 +96,12 @@ class ComponentsTest < Test::Unit::TestCase assert_equal "Ring, ring: Lady of the House, speaking", @response.body end + def test_etag_is_set_for_parent_template_when_calling_from_template + get :calling_from_template + expected_etag = etag_for("Ring, ring: Lady of the House, speaking") + assert_equal expected_etag, @response.headers['ETag'] + end + def test_internal_calling get :internal_caller assert_equal "Are you there? Yes, ma'am", @response.body @@ -126,4 +132,9 @@ class ComponentsTest < Test::Unit::TestCase assert_equal "Lady of the House, speaking", @response.body end + + protected + def etag_for(text) + %("#{Digest::MD5.hexdigest(text)}") + end end |