From bfe58ac05d4b7ba5d5c04c3aa9a719e340b2111e Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Fri, 7 Aug 2009 11:33:54 -0300 Subject: Get all ActionController partial rendering to use ActionView's partial code. Consequences: * It is not possible to always pre-determine the layout before going to ActionView. This was *already* broken for render :partial => @object, :layout => true. This is now handled by overriding render_to_body in layouts.rb and manually injecting the partial's response. This needs to be done in ActionController since ActionController knows enough to get _layout_for_option. There is probably a better abstraction here. * As a result, all partial rendering can correctly restrict their layouts to the mime type of the rendered partial. This could have previously caused a bug in some edge cases. * If other layout-like options are added, they might need to add special code for the case of render :partial. We should try to think of an alternate solution, if possible, but this works for the cases we know of now. --- actionpack/lib/action_view/render/partials.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'actionpack/lib/action_view/render') diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb index b7b14e9007..48cba9c02b 100644 --- a/actionpack/lib/action_view/render/partials.rb +++ b/actionpack/lib/action_view/render/partials.rb @@ -185,6 +185,8 @@ module ActionView def render_partial(options) @assigns_added = false + # TODO: Handle other details here. + self.formats = options[:_details][:formats] _render_partial(options) end @@ -235,6 +237,8 @@ module ActionView end def _render_partial_collection(collection, options = {}, template = nil, &block) #:nodoc: + options[:_template] ||= template + return nil if collection.blank? if options.key?(:spacer_template) -- cgit v1.2.3