When you render a partial collection you actually get a variable with the index. It's the name of the partial + '_counter' so here it should be `image_counter`

You should be able to remove the extra code below. See: http://log.gmarik.info/2007/09/rails-collection-index-within-partial.html