Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't prepare response when rendering a component. Closes #8493.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6875 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 3f336ad5cc9fc6b9ca9947719fce3b9e8ad0dbb6 1 parent 77eb0a8
@jeremy jeremy authored
View
2  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:
View
2  actionpack/lib/action_controller/base.rb
@@ -496,7 +496,7 @@ def process(request, response, method = :perform_action, *arguments) #:nodoc:
assign_default_content_type_and_charset
response.request = request
- response.prepare!
+ response.prepare! unless component_request?
response
ensure
process_cleanup
View
11 actionpack/test/controller/components_test.rb
@@ -96,6 +96,12 @@ def test_calling_from_template
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 @@ def test_component_as_string_redirect_renders_redirecte_action
assert_equal "Lady of the House, speaking", @response.body
end
+
+ protected
+ def etag_for(text)
+ %("#{Digest::MD5.hexdigest(text)}")
+ end
end

0 comments on commit 3f336ad

Please sign in to comment.
Something went wrong with that request. Please try again.