Wrapping rendered collections into a layout without a file
You’ve probably done this:
Maybe you want to wrap that product partial in
on your home page, and
somewhere else. Solution? Pass a local or set some sort of instance variable. Ew, right?
There’s a little-known (at least, to me and the four people I spoke to) option to pass a layout for this partial.
But I find that to be gross most of the time because so often these are just helper classes. So let’s break ActionView:
And now, we can, perhaps naively,
Note: Passing an ERB yield will remove where we want to actually yield.