Many partials in one view

Is it possible to render 5 different partials in one view, each of
which is rendered by an instance variable from a different action? Or
must all instance variables that render all partials for a given view
come from the same action?

Charlie

On 11/6/07, charlie caroff [email protected] wrote:

Is it possible to render 5 different partials in one view, each of
which is rendered by an instance variable from a different action? Or
must all instance variables that render all partials for a given view
come from the same action?

Charlie

Well there is a component structure that creates a completely new
request,
but if you want 5 per one page, then say good bye to any sort of quick
response time.

Otherwise no, you need to have the variables set by the related
controller /
action.

Jason

On Nov 6, 2007 5:02 PM, charlie caroff [email protected] wrote:

Is it possible to render 5 different partials in one view, each of
which is rendered by an instance variable from a different action? Or
must all instance variables that render all partials for a given view
come from the same action?

Only one action is performed at a time (unless you use components), so
everything needs to be set from there or in something called from
there.

But don’t use instance variables in partials:
http://www.robertshowalter.com/articles/2007/07/24/dont-use-instance-variables-in-partials

On Nov 6, 2007, at 2:02 PM, charlie caroff wrote:

Is it possible to render 5 different partials in one view, each of
which is rendered by an instance variable from a different action? Or
must all instance variables that render all partials for a given view
come from the same action?

Like Bob said, don’t use instance vars for partials. Have a look at
this article for some guidelines on combing views, layouts, and
partials to achieve modular design and retain OOP objectives.

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

– greg willits