How to pass data from a view to a partial rendered in a layout?

In the application I’m working on, a layout renders a partial that
displays a breadcrumb navigation bar across the top of a page. In
other words, the layout renders a partial that displays breadcrumbs.

But the navigation bar rendered by a partial in a layout needs to use
data from the view to determine which breadcrumbs to display.

My question is: how can data be passed from a view to a partial
rendered in a layout? The ActionController::Layout::ClassMethods
explains that data in a view is shared by a partial rendered by the
view (using :locals), but I see no reference for how to pass data from
a view to a partial being rendered in the layout in which the view
“resides.” Thanks.

On Nov 1, 2007, at 12:30 AM, athem wrote:

My question is: how can data be passed from a view to a partial
rendered in a layout? The ActionController::Layout::ClassMethods
explains that data in a view is shared by a partial rendered by the
view (using :locals), but I see no reference for how to pass data from
a view to a partial being rendered in the layout in which the view
“resides.” Thanks.

This article explains some different techniques for doing that:

http://www.railsdev.ws/blog/3/modular-page-assembly-in-rails/

– gw