Forum: Ruby on Rails RE: Reuse Partials

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
9163be77c2abb8146d6e7ad48af58553?d=identicon&s=25 Bharat Ahluwalia (Guest)
on 2006-05-31 03:46
(Received via mailing list)
> From: Eugene Louw <>
> 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.

This topic is locked and can not be replied to.