Permalink
Browse files

Fix stack overflow when rendering partials with layouts with no block.

  • Loading branch information...
1 parent 982b20d commit 53f82e282d1ec317655a080c6948ca72a9ef5397 @oggy committed Sep 24, 2010
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/template_streaming.rb
View
12 lib/template_streaming.rb
@@ -246,7 +246,17 @@ def _render_with_layout_with_template_streaming(options, local_assigns, &block)
end
end
else
- _render_with_layout_without_template_streaming(options, local_assigns, &block)
+ # We may have set @_proc_for_layout in an outer render, but
+ # render(:layout => , :partial =>) uses @content_for_layout, and
+ # @_proc_for_layout overrides @content_for_layout. Thus, we need to
+ # clear @_proc_for_layout for the duration of this render.
+ original_proc_for_layout = @_proc_for_layout
+ @_proc_for_layout = nil
+ begin
+ _render_with_layout_without_template_streaming(options, local_assigns, &block)
+ ensure
+ @_proc_for_layout = original_proc_for_layout
+ end
end
end

0 comments on commit 53f82e2

Please sign in to comment.