Makes sense. Very cool!
On Nov 23, 8:46 pm, "Yehuda Katz" <
wyc...@gmail.com> wrote:
> And I forgot to say that you build your subtemplate exactly the same as you
> would build a regular template, using catch_content(:for_layout).
> -- Yehuda
>
>
>
>
>
> On Sun, Nov 23, 2008 at 8:44 PM, Yehuda Katz <
wyc...@gmail.com> wrote:
> > The easiest way I've found to do nested layouts is:
> > render(render(:layout => :sublayout))
>
> > in effect, render(:layout => :sublayout) will do the render against the
> > sublayout, and the outer layout will embed that into the default layout. You
> > could also do:
>
> > render(render(:layout => :sublayout), :layout => :another_layout)
>
> > which would embed the rendering with "sublayout" inside "another_layout".
>
> > The reason this works is that render(:layout => :sublayout) returns a
> > string, and render() takes a string, and embeds it into the default layout
> > (or another layout if specified).
>
> > Does that make sense?
>