Skip to content
Browse files

Stack @output_buffer for nested rendering

  • Loading branch information...
1 parent 4d4c8e2 commit f55ad960d22337d0d92a93724f1cc3ad45200836 @jeremy jeremy committed Jun 3, 2008
View
4 actionpack/lib/action_view/template_handlers/compilable.rb
@@ -106,7 +106,7 @@ def create_template_source(template, render_symbol)
locals_code << "#{key} = local_assigns[:#{key}]\n"
end
- "def #{render_symbol}(local_assigns)\n#{locals_code}#{body}\nend"
+ "def #{render_symbol}(local_assigns)\nold_output_buffer = @output_buffer;#{locals_code}#{body}\nensure\n@output_buffer = old_output_buffer\nend"
end
# Return true if the given template was compiled for a superset of the keys in local_assigns
@@ -125,4 +125,4 @@ def template_changed_since?(file_name, compile_time)
end
end
-end
+end
View
2 actionpack/test/controller/caching_test.rb
@@ -512,7 +512,7 @@ def test_fragment_for
def test_cache_erb_fragment
@store.write('views/expensive', 'fragment content')
- @controller.template.output_buffer = 'generated till now -> '
+ @controller.response.template.output_buffer = 'generated till now -> '
assert_equal( 'generated till now -> fragment content',
ActionView::TemplateHandlers::ERB.new(@controller).cache_fragment(Proc.new{ }, 'expensive'))

0 comments on commit f55ad96

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