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

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?

Hi Brian,

You can find out the current index by calling:

<%= message_counter %>

In your partial.

~ Ben

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs