Partials, Layouts and Collections

Hi All, I am trying to make use of the new render partial functionality where in the index view I have

<%= render :partial => @people%> #in rails 2.0 it detects this as a collection

and in the show

<%= render :partial => @person%> #in rails 2.0 it detects this as an object

The _person.html.erb partial is

<td><%=h person.first_name %></td> <td><%=h person.last_name %></td>

However I would like in the index view to add links to show or destroy and in the show view add an edit link.

I tried to use the new layout for partials feature

<%= render :partial => @people, :layout => 'index'%> <%= render :partial => @people, :layout => 'show'%>

where the _index.html.erb contained the show and destroy links and the _show.html.erb contains the edit link. However for the layout it only seems to be rendered once for a collection not once for each object in the collection. Am I doing something wrong or is there a neat way round this.

Thanks

Anthony

you'll need to place the @people collection into a "for" statment and iterate through them, you'll see similar contructs in the index.html.erb if you scaffold.

<% for person in @people %> <%= h(person.first_name) %>

etc.....

<% end %>