Rendering Partials w/Collections - is there a way to find th


#1

This seems obvious, but I wasn’t able to find info on it easily. If
you are rendering a partial from a collection:
<%= render :partial => ‘message’, :collection => @messages %>

Is there a way inside the partial to tell what item in the collection
you are on? For example, if I am in the first element in the
collection, I want to do something different?


#2

Hi Brian,

You can find out the current index by calling:

<%= message_counter %>

In your partial.

~ Ben