class ActionView::PartialRenderer

def collection_with_template

def collection_with_template
  view, locals, template = @view, @locals, @template
  as, counter = @variable, @variable_counter
  if layout = @options[:layout]
    layout = find_template(layout, @template_keys)
  end
  index = -1
  @collection.map do |object|
    locals[as]      = object
    locals[counter] = (index += 1)
    content = template.render(view, locals)
    content = layout.render(view, locals) { content } if layout
    content
  end
end