aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2012-11-19 12:43:23 -0800
committerJosé Valim <jose.valim@plataformatec.com.br>2012-11-19 12:43:23 -0800
commita1c7eae87bdfd7a10548cc10b6dce4c23983bb1d (patch)
tree96deee30602aff3b8bc4dd90a83475fcfb1deb5b
parent60790e852a4f349c424a7504d85f9521e13e611e (diff)
parent1d07d3d8105efdede4299a491035a980f7778049 (diff)
downloadrails-a1c7eae87bdfd7a10548cc10b6dce4c23983bb1d.tar.gz
rails-a1c7eae87bdfd7a10548cc10b6dce4c23983bb1d.tar.bz2
rails-a1c7eae87bdfd7a10548cc10b6dce4c23983bb1d.zip
Merge pull request #8212 from senny/8197_make_render_in_spacer_template_work
render every partial with a new `PartialRenderer`.
-rw-r--r--actionpack/CHANGELOG.md6
-rw-r--r--actionpack/lib/action_view/renderer/renderer.rb4
-rw-r--r--actionpack/test/controller/render_test.rb10
3 files changed, 18 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index 1ebc75ed2f..0f1e1f303f 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,5 +1,11 @@
## Rails 4.0.0 (unreleased) ##
+* Render every partial with a new `ActionView::PartialRenderer`. This resolves
+ issues when rendering nested partials.
+ Fix #8197
+
+ *Yves Senn*
+
* Introduce `ActionView::Template::Handlers::ERB.escape_whitelist`. This is a list
of mime types where template text is not html escaped by default. It prevents `Jack & Joe`
from rendering as `Jack &amp; Joe` for the whitelisted mime types. The default whitelist
diff --git a/actionpack/lib/action_view/renderer/renderer.rb b/actionpack/lib/action_view/renderer/renderer.rb
index bf1b5a7d22..dfef43bc9d 100644
--- a/actionpack/lib/action_view/renderer/renderer.rb
+++ b/actionpack/lib/action_view/renderer/renderer.rb
@@ -44,11 +44,11 @@ module ActionView
private
def _template_renderer #:nodoc:
- @_template_renderer ||= TemplateRenderer.new(@lookup_context)
+ TemplateRenderer.new(@lookup_context)
end
def _partial_renderer #:nodoc:
- @_partial_renderer ||= PartialRenderer.new(@lookup_context)
+ PartialRenderer.new(@lookup_context)
end
end
end
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index aa33f01d02..859ed1466b 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -646,6 +646,10 @@ class TestController < ActionController::Base
render :partial => "customer", :spacer_template => "partial_only", :collection => [ Customer.new("david"), Customer.new("mary") ]
end
+ def partial_collection_with_spacer_which_uses_render
+ render :partial => "customer", :spacer_template => "partial_with_partial", :collection => [ Customer.new("david"), Customer.new("mary") ]
+ end
+
def partial_collection_shorthand_with_locals
render :partial => [ Customer.new("david"), Customer.new("mary") ], :locals => { :greeting => "Bonjour" }
end
@@ -1445,6 +1449,12 @@ class RenderTest < ActionController::TestCase
assert_template :partial => '_customer'
end
+ def test_partial_collection_with_spacer_which_uses_render
+ get :partial_collection_with_spacer_which_uses_render
+ assert_equal "Hello: davidpartial html\npartial with partial\nHello: mary", @response.body
+ assert_template :partial => '_customer'
+ end
+
def test_partial_collection_shorthand_with_locals
get :partial_collection_shorthand_with_locals
assert_equal "Bonjour: davidBonjour: mary", @response.body