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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 11/6/07, charlie caroff <charlie.caroff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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? > > CharlieWell 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 6, 2007 5:02 PM, charlie caroff <charlie.caroff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---