Partial counters start from 1 in 2.1
Reported by Frederick Cheung | June 5th, 2008 @ 08:59 PM
patch to restore starting from 0
Comments and changes to this ticket
-
Pratik June 5th, 2008 @ 09:07 PM
- → State changed from new to resolved
Fixed in http://github.com/rails/rails/co...
-

Jan June 13th, 2008 @ 10:17 PM
!? according to lifo in #rails-contrib this behaviour was desired, not a bug.
-
Pratik June 13th, 2008 @ 10:39 PM
Yeah, but majority of people thought it is more sensible to change this behavior in next major release, and noticing everyone in advanced.
Thanks.
-

DavidBackeus September 6th, 2008 @ 07:48 PM
- → Tag changed from to actionpack patch
Just to clarify the counter has started from 1 ever since 2.0.2. You have to go back to the 1.2 branch to see it start at 0.
2.0.x: http://github.com/rails/rails/tr...
1.2.x: http://github.com/rails/rails/tr...
I had applications dependent on this behaviour (one of them using 2.0.2) so I was kind of freaked out to see them break. It's also not in the "official" change log (http://gist.github.com/8946) so I can't see how "everyone" was noticed in advance.
In the end I think it makes more sense to start at 0 though so I'll just patch my apps and be happy about it ;)
-

Frederick Cheung September 6th, 2008 @ 07:54 PM
Is that really true? both 1.2 and 2.0 eventually use each_with_index to set the value of the counter when rendering each item in the collection. add_counter_to_local_assigns is only called when rendering a single item (it is a bit weird that the default value of that counter is 1)
I believe Pratik was talking about making it start from 1 in a future version
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Source available from github
The Git repository resides at http://github.com/rails
Check out the current development trunk (Edge Rails) with:
git clone git://github.com/rails/rails.git
Creating or reviewing a patch
See the contributor guide.
Creating a feature request
Please don't. If you want a new feature in Rails, you'll have to pull up your sleeves and get busy yourself. Or convince someone else to do it. See the contributor guide on how to get going. But posting them here is just going to lead to ticket root.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post the code sample that causes the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
Security vulnerabilities should be reported via an email to security@rubyonrails.org, do not use trac for reporting security vulnerabilities. All content in trac is publicly available as soon as it is posted.
Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kinda bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to sign on to with a "I'm having this problem too".
