Hi, A bit unsure how this gets accomplished - particularly how it might get set up in the layout. Currently - This is my welcome.rthml (what comes up at main page) <% if @u %> <%= render :partial => "main/session" %> <% else %> <%= render :partial => "main/login" %> <%= render :partial => "main/register" %> <% end %> But in my layout currently to make sure in what divs partials are placed I''m doing this: <div id="main"> <%= render(:partial => "session" ) %> </div> <div id="left"> <%= render(:partial => "register" ) %> <%= render(:partial => "login" ) %> </div> Because the layout is set up as it is, the if /else in the welcome doesn''t really effect output. Any suggestions ? TIA Stuart
On Aug 8, 2006, at 4:41 AM, Dark Ambient wrote:> Because the layout is set up as it is, the if /else in the welcome > doesn''t really effect output.I''m not really clear what this problem is. It appears you''re rendering the same partial twice, once in the layout and once in the view, but I may be entirely misunderstanding.> Any suggestions ?How about putting the conditional renders into a helper? -- -- Tom Mornini
Errr.... <div id="main"> <%= render(:partial => "session" ) if @u %> </div> <div id="left"> <% unless @u %> <%= render(:partial => "register" ) %> <%= render(:partial => "login" ) %> <% end %> </div> Max
Stuart Fellowes wrote:> Hi, > A bit unsure how this gets accomplished - particularly how it might > get set up in the layout. > Currently - > This is my welcome.rthml (what comes up at main page) > <% if @u %> > <%= render :partial => "main/session" %> > <% else %> > <%= render :partial => "main/login" %> > <%= render :partial => "main/register" %> > <% end %> > > But in my layout currently to make sure in what divs partials are > placed I''m doing this: > <div id="main"> > <%= render(:partial => "session" ) %> > </div> > <div id="left"> > <%= render(:partial => "register" ) %> > <%= render(:partial => "login" ) %> > </div> > > Because the layout is set up as it is, the if /else in the welcome > doesn''t really effect output. > Any suggestions ? > > TIA > StuartIn your layout, you should add @content_for_layout. This is where welcome.rhtml be placed. -- Posted via http://www.ruby-forum.com/.