Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Partial counters start from 1 in 2.1

#344

patch to restore starting from 0

Reported by Frederick Cheung · June 5th, 2008 @ 08:59 PM

State: resolved
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Pratik
    Pratik
    • State changed from new to resolved

    June 5th, 2008 @ 09:07 PM

  2. Jan
    Jan

    !? according to lifo in #rails-contrib this behaviour was desired, not a bug.

    June 13th, 2008 @ 10:17 PM

  3. Pratik
    Pratik

    Yeah, but majority of people thought it is more sensible to change this behavior in next major release, and noticing everyone in advanced.

    Thanks.

    June 13th, 2008 @ 10:39 PM

  4. DavidBackeus
    DavidBackeus
    • Tag set 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 ;)

    September 6th, 2008 @ 07:48 PM

  5. Frederick Cheung
    Frederick Cheung

    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

    September 6th, 2008 @ 07:54 PM