<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -269,7 +269,7 @@ module Merb::RenderMixin
     with = [opts.delete(:with)].flatten
     as = opts.delete(:as) || template_location.match(%r[.*/_([^\.]*)])[1]
     
-    @_merb_partial_locals = opts
+    @_merb_partial_locals = opts.merge(:collection_index =&gt; 0, :collection_size =&gt; with.size)
     
     # this handles an edge-case where the name of the partial is _foo.* and your opts
     # have :foo as a key.
@@ -278,7 +278,9 @@ module Merb::RenderMixin
     sent_template = with.map do |temp|
       @_merb_partial_locals[as.to_sym] = temp unless named_local
       if template_method &amp;&amp; self.respond_to?(template_method)
-        send(template_method)
+        sent = send(template_method)
+        @_merb_partial_locals[:collection_index] += 1
+        sent
       else
         raise TemplateNotFound, &quot;Could not find template at #{template_location}.*&quot;
       end</diff>
      <filename>lib/merb-core/controller/mixins/render.rb</filename>
    </modified>
    <modified>
      <diff>@@ -65,6 +65,13 @@ module Merb::Test::Fixtures
         render
       end
     end
+    
+   class PartialWithCollectionsAndCounter &lt; RenderIt
+      def index
+        @foo = %w(1 2 3 4 5)
+        render
+      end
+    end
 
     class PartialWithLocals &lt; RenderIt
 
@@ -111,4 +118,4 @@ module Merb::Test::Fixtures
       end
     end
   end
-end
+end
\ No newline at end of file</diff>
      <filename>spec/public/abstract_controller/controllers/partial.rb</filename>
    </modified>
    <modified>
      <diff>@@ -50,6 +50,10 @@ describe Merb::AbstractController, &quot; Partials&quot; do
     dispatch_should_make_body(&quot;BasicPartialWithMultipleRoots&quot;, &quot;Base Index: Alt Partial&quot;)
   end
   
+  it &quot;should be able to count collections&quot; do
+    dispatch_should_make_body(&quot;PartialWithCollectionsAndCounter&quot;, &quot;Partial counting: 0/5 1/5 2/5 3/5 4/5 &quot;)
+  end
+  
   it &quot;should render a partial using an absolute path&quot; do
     dispatch_should_make_body(&quot;WithAbsolutePartial&quot;, &quot;Index Absolute Partial&quot;)
   end</diff>
      <filename>spec/public/abstract_controller/partial_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7cb2d479de25ea46661584b0b636810b0def0f01</id>
    </parent>
  </parents>
  <author>
    <name>Carl Lerche</name>
    <email>carllerche@mac.com</email>
  </author>
  <url>http://github.com/wycats/merb-core/commit/fea472686b12a0f5da9c2eb1dfab4266836d2fbf</url>
  <id>fea472686b12a0f5da9c2eb1dfab4266836d2fbf</id>
  <committed-date>2008-07-24T22:29:40-07:00</committed-date>
  <authored-date>2008-07-24T22:29:40-07:00</authored-date>
  <message>Adding the current index and collection size for partials rendered with a collection</message>
  <tree>4c7149fdc95d03de5f5d2945854329f5a39b3b06</tree>
  <committer>
    <name>Carl Lerche</name>
    <email>carllerche@mac.com</email>
  </committer>
</commit>
