diff options
author | José Valim <jose.valim@gmail.com> | 2009-12-25 20:25:18 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-12-26 14:11:04 +0100 |
commit | 48273a44c6176b72e432f365c7905fd8c4d4b754 (patch) | |
tree | 98c6a0ac6afb046e8f93dd96e45becdfb1dc41bb /actionpack/lib/action_view | |
parent | 561885aea28c9422fbdfb2be54220b10d4911973 (diff) | |
download | rails-48273a44c6176b72e432f365c7905fd8c4d4b754.tar.gz rails-48273a44c6176b72e432f365c7905fd8c4d4b754.tar.bz2 rails-48273a44c6176b72e432f365c7905fd8c4d4b754.zip |
Wrap layout rendering in one method: _render_layout (this should make partial instrumentation easier).
Diffstat (limited to 'actionpack/lib/action_view')
-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 |