Wednesday, January 2, 2008

Undocumented Rails features - render collection with index

When I want to display the index of a collection in the following statement:
<%= render :partial => "subscription", :collection => @subscriptions %>

I can say:
<%= subscription_counter + 1 %>

The pattern is "partial_name_counter"

More here:
http://www.pgrs.net/2007/7/20/render-partial-with-collection-has-hidden-counter

No comments: