diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/render/partials.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/render/rendering.rb | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb index aeaf1ee4ff..00b12ad3a9 100644 --- a/actionpack/lib/action_view/render/partials.rb +++ b/actionpack/lib/action_view/render/partials.rb @@ -274,7 +274,7 @@ module ActionView if @block || !options[:layout] content else - find_template(options[:layout]).render(@view, @locals) { content } + @view._render_layout(find_template(options[:layout]), @locals){ content } end end diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index d4d16b4d98..c4033fad9e 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -73,7 +73,6 @@ module ActionView # would be <html>Hello David</html>. def _layout_for(name = nil, &block) return @_content_for[name || :layout] if !block_given? || name - capture(&block) end @@ -88,10 +87,7 @@ module ActionView end def _render_text(content, layout, locals) - content = layout.render(self, locals) do |*name| - _layout_for(*name) { content } - end if layout - + content = _render_layout(layout, locals){ content } if layout content end @@ -121,10 +117,14 @@ module ActionView if layout @_layout = layout.identifier logger.info("Rendering template within #{layout.inspect}") if logger - content = layout.render(self, locals) { |*name| _layout_for(*name) } + content = _render_layout(layout, locals) end content end + + def _render_layout(layout, locals, &block) + layout.render(self, locals){ |*name| _layout_for(*name, &block) } + end end end |