# Bug in Rails 2.1.0 rendering partial "counter" starts at 1?

**URL:** <https://www.ruby-forum.com/t/bug-in-rails-2-1-0-rendering-partial-counter-starts-at-1/139209>\
**Category:** Rails\
**Created:** [June 1, 2008, 9:33pm UTC](https://www.ruby-forum.com/t/bug-in-rails-2-1-0-rendering-partial-counter-starts-at-1/139209 "2008-06-01T21:33:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a88e4f/32.png) [@eric99](https://www.ruby-forum.com/u/eric99)\
**Post date:** [June 1, 2008, 9:33pm UTC](https://www.ruby-forum.com/t/bug-in-rails-2-1-0-rendering-partial-counter-starts-at-1/139209/1 "2008-06-01T21:33:35Z")

</div>

I just upgraded to Rails 2.1 and found that the “counter” property that  
exists while rendering a collection using a partial now starts at 1,  
instead of 0 (as before). I verified that this was working in Rails  
2.0.2, but it has changed in 2.1. If you have a dependency on this, be  
careful.

---

<div class="post-metadata">

**Author:** ![eric99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a88e4f/32.png) [@eric99](https://www.ruby-forum.com/u/eric99)\
**Post date:** [June 2, 2008, 5:43pm UTC](https://www.ruby-forum.com/t/bug-in-rails-2-1-0-rendering-partial-counter-starts-at-1/139209/2 "2008-06-02T17:43:14Z")

</div>

Eric Ly wrote:

> I just upgraded to Rails 2.1 and found that the “counter” property that  
> exists while rendering a collection using a partial now starts at 1,  
> instead of 0 (as before). I verified that this was working in Rails  
> 2.0.2, but it has changed in 2.1. If you have a dependency on this, be  
> careful.

That’s got to be a bug, right? Have you found any release notes that  
discuss this?

---

<div class="post-metadata">

**Author:** ![eric99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a88e4f/32.png) [@eric99](https://www.ruby-forum.com/u/eric99)\
**Post date:** [June 2, 2008, 8:21pm UTC](https://www.ruby-forum.com/t/bug-in-rails-2-1-0-rendering-partial-counter-starts-at-1/139209/3 "2008-06-02T20:21:11Z")

</div>

Cayce B. wrote:

> That’s got to be a bug, right? Have you found any release notes that  
> discuss this?

No, its a feature. According to lifo in #rails-contrib this is the  
desired behaviour. I agree btw. even if I have to change some partials  
now.

---

<div class="post-metadata">

**Author:** ![eric99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a88e4f/32.png) [@eric99](https://www.ruby-forum.com/u/eric99)\
**Post date:** [June 2, 2008, 10:23pm UTC](https://www.ruby-forum.com/t/bug-in-rails-2-1-0-rendering-partial-counter-starts-at-1/139209/4 "2008-06-02T22:23:41Z")

</div>

Jan Schwenzien wrote:

> Cayce B. wrote:
> 
> > That’s got to be a bug, right? Have you found any release notes that  
> > discuss this?
> 
> No, its a feature. According to lifo in #rails-contrib this is the  
> desired behaviour. I agree btw. even if I have to change some partials  
> now.

It’s not so much about the work that needs to be done to change things -  
those issues are easily found/changed. To me, it’s a fundamental  
language thing. Maybe I’m just a purist. Ruby as a language counts from  
zero. IMHO Rails should in this case operate the same as the basics of  
the underlying language.

That being said, and me not being a contributor, I’m off to fix my code.  
😉

---

<div class="post-metadata">

**Author:** ![eric99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a88e4f/32.png) [@eric99](https://www.ruby-forum.com/u/eric99)\
**Post date:** [June 13, 2008, 9:57pm UTC](https://www.ruby-forum.com/t/bug-in-rails-2-1-0-rendering-partial-counter-starts-at-1/139209/5 "2008-06-13T21:57:10Z")

</div>

Cayce B. wrote:

> Jan Schwenzien wrote:
> 
> > Cayce B. wrote:
> > 
> > > That’s got to be a bug, right? Have you found any release notes that  
> > > discuss this?
> > 
> > No, its a feature. According to lifo in #rails-contrib this is the  
> > desired behaviour. I agree btw. even if I have to change some partials  
> > now.
> 
> It’s not so much about the work that needs to be done to change things -  
> those issues are easily found/changed. To me, it’s a fundamental  
> language thing. Maybe I’m just a purist. Ruby as a language counts from  
> zero. IMHO Rails should in this case operate the same as the basics of  
> the underlying language.
> 
> That being said, and me not being a contributor, I’m off to fix my code.  
> 😉

I guess I went off to change code too soon. Looks like this has been  
fixed/reverted (however you see it).

[http://rails.lighthouseapp.com/projects/8994/tickets/344-partial-counters-start-from-1-in-2-1](http://rails.lighthouseapp.com/projects/8994/tickets/344-partial-counters-start-from-1-in-2-1)

Woot zero index!
