[Rails] Rendering partials based on conditions

Dark Ambient
Tue, 08 Aug 2006 11:41:09 -0000

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:

<%= render(:partial => "session" ) %>


<%= render(:partial => "register" ) %>
<%= render(:partial => "login" ) %>


Because the layout is set up as it is, the if /else in the welcome
doesn''t really effect output.
Any suggestions ?

TIA
Stuart