From 6d134017379892cce8d62ba5645767489b525e18 Mon Sep 17 00:00:00 2001 From: Frederick Cheung Date: Thu, 5 Jun 2008 20:48:42 +0100 Subject: [PATCH] Make partial counter start from 0 (as in 2.0.x) --- actionpack/lib/action_view/partial_template.rb | 2 +- actionpack/test/controller/new_render_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_view/partial_template.rb b/actionpack/lib/action_view/partial_template.rb index 1fb3aae..0b374db 100644 --- a/actionpack/lib/action_view/partial_template.rb +++ b/actionpack/lib/action_view/partial_template.rb @@ -22,10 +22,10 @@ module ActionView #:nodoc: end def render_member(object) - @locals[@counter_name] += 1 @locals[:object] = @locals[@variable_name] = object template = render_template + @locals[@counter_name] += 1 @locals.delete(@variable_name) @locals.delete(:object) diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb index 6e2c6d9..3b439a3 100644 --- a/actionpack/test/controller/new_render_test.rb +++ b/actionpack/test/controller/new_render_test.rb @@ -742,7 +742,7 @@ EOS def test_partial_collection_with_counter get :partial_collection_with_counter - assert_equal "david1mary2", @response.body + assert_equal "david0mary1", @response.body end def test_partial_collection_with_locals @@ -762,7 +762,7 @@ EOS def test_partial_collection_shorthand_with_different_types_of_records get :partial_collection_shorthand_with_different_types_of_records - assert_equal "Bonjour bad customer: mark1Bonjour good customer: craig2Bonjour bad customer: john3Bonjour good customer: zach4Bonjour good customer: brandon5Bonjour bad customer: dan6", @response.body + assert_equal "Bonjour bad customer: mark0Bonjour good customer: craig1Bonjour bad customer: john2Bonjour good customer: zach3Bonjour good customer: brandon4Bonjour bad customer: dan5", @response.body end def test_empty_partial_collection -- 1.5.4.4