RE: Reuse Partials

From: Eugene L. [email protected]
Subject: [Rails] Re: Reuse Partials
I think I’ve found the problem, I need to give each partial that I
render a new ID, but how do I go about doing that?

Simply create a variable in the main page and that will be available
inside the partial.


<% while @counter <@count_to_be_displayed%>
<%= render: partial => “partial”
<% @counter += 1%>

In the partial you can access the @counter variable and use that.

Hope this is what you were looking for, if not repost with more details
and I should be able to help. Just finished some interesting work on
partials in my project and so the concepts are very fresh in my mind
right now.