rails/rails — pull request #12875 by macmartine (2013-11-13 21:55:25+00:00)
Title: Allow passing of array and block to layout

Fix for #12826 -- Layouts were unable to take arrays, as the docs state they should.

- This problem starts with the block not getting passed to template.render in collection_with_template.

- From there, we need to get the layout path (from the first object in the array).

- Finally, in collection_with_template, we only want to call layout.render after template.render if a @options[:layout] does not equal @options[:partial]. The reason for this, is that when given an array, we use the first object in it to decide which layout is used.
rendering_helper then sets the partial to the layout with: options.merge(:partial => options[:layout])
We don't actually want to use the partial in this case though; If we were to call layout.render after template.render in this case we'd get un-desirable results when yielding the block.

Let me know if there's a preferable approach to this.