diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-08-08 12:26:58 -0300 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-08-08 12:44:26 -0300 |
commit | d0301e13f4d6e2ddf956ecf80e85384c1ea5346c (patch) | |
tree | 3123d73744b834834579bf1996e0c286952c110c /actionpack/lib/abstract_controller | |
parent | a8645593a4446a89b2e699e153adca968340581a (diff) | |
download | rails-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.rb | 18 |
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 |