diff options
Diffstat (limited to 'actionpack/lib/abstract_controller/layouts.rb')
-rw-r--r-- | actionpack/lib/abstract_controller/layouts.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index f021dd8b62..038598a3b3 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -88,6 +88,22 @@ module AbstractController end end + def render_to_body(options = {}) + response = super + + if options.key?(:partial) + # This is a little bit messy. We need to explicitly handle partial + # layouts here since the core lookup logic is in the view, but + # we need to determine the layout based on the controller + if options.key?(:layout) + layout = _layout_for_option(options[:layout], options[:_template].details) + response = layout.render(view_context, options[:locals]) { response } + end + end + + response + end + private # This will be overwritten by _write_layout_method def _layout(details) end |