aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-08-08 12:26:58 -0300
committerYehuda Katz <wycats@gmail.com>2009-08-08 12:44:26 -0300
commitd0301e13f4d6e2ddf956ecf80e85384c1ea5346c (patch)
tree3123d73744b834834579bf1996e0c286952c110c /actionpack/lib/abstract_controller
parenta8645593a4446a89b2e699e153adca968340581a (diff)
downloadrails-d0301e13f4d6e2ddf956ecf80e85384c1ea5346c.tar.gz
rails-d0301e13f4d6e2ddf956ecf80e85384c1ea5346c.tar.bz2
rails-d0301e13f4d6e2ddf956ecf80e85384c1ea5346c.zip
First pass at making partial rendering an Object. More cleanup to come.
Diffstat (limited to 'actionpack/lib/abstract_controller')
-rw-r--r--actionpack/lib/abstract_controller/layouts.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb
index c1fb80415b..0063d54149 100644
--- a/actionpack/lib/abstract_controller/layouts.rb
+++ b/actionpack/lib/abstract_controller/layouts.rb
@@ -89,16 +89,18 @@ module AbstractController
end
def render_to_body(options = {})
+ # In the case of a partial with a layout, handle the layout
+ # here, and make sure the view does not try to handle it
+ layout = options.delete(:layout) if options.key?(:partial)
+
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
+ # 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 layout
+ layout = _layout_for_option(layout, options[:_template].details)
+ response = layout.render(view_context, options[:locals] || {}) { response }
end
response