Topic: Problem with rendering partials of a collection
Hi,
I am trying to render a collection of blog entries.
First, in my page that will include the partial renders, I have a render_component which will call an action to generate the collection:
<%=render_component :controller => 'entries', :action => 'recentEntries'%>
In the EntriesController's recentEntries method, the collection is generated and a call to render is made, as follows
render :partial=>'recentEntry',:collection=>@entries
Here are the contents of the _recentEntry.rhtml partial render file:
<tr>
<td>
<%= link_to recentEntry.title, :controller=>'entries', :action => 'show', :id => recentEntry.id %> by
<%= link_to recentEntry.blog.user.id, :controller=>'users', :action => 'show', :id => recentEntry.blog.user %>
</td>
</tr>
Everything works perfectly EXCEPT for some reason, the id of every recentEntry element will be exactly the same as the very first recentEntry in the collection. If I change from " :id=>recentEntry.id" to ":id=>recentEntry.title" it works perfectly fine, which is really bewildering to me. I hope someone could shed some light on this..thanks a lot!!