check out my new blog at

Sunday, September 02, 2007

Rails: collection index within partial render

Tonight i've found a tiny and nice feature i was missing sometimes...(in order to have it created custom helper)

So when you have:

<%= render :partial => 'games/game', :collection => @games %>

you may sometimes need to access collection index. And you can easily do that by using local variable named by such convention <partial_name>_counter
Like this:


<li> <%= game_counter %> item

PS. and yes you can always use ordered(numbered)lists(ol instead ul)


Post a Comment

<< Home