From 98c16a3320c8f018b6c30a54f61743c540c517f4 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 11 Jan 2005 00:27:33 +0000 Subject: [PATCH] Added fourth argument to render_collection_of_partials that allows you to specify local_assigns -- just like render_partial #432 [zenspider] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@383 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 2 ++ actionpack/lib/action_view/partials.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index d23a2abb04..701531fa95 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added fourth argument to render_collection_of_partials that allows you to specify local_assigns -- just like render_partial #432 [zenspider] + * Fixed that host would choke when cgi.host returned nil #432 [Tobias Luetke] * Added that form helpers now take an index option #448 [Tim Bates] diff --git a/actionpack/lib/action_view/partials.rb b/actionpack/lib/action_view/partials.rb index 927ef2a977..1255a060dd 100644 --- a/actionpack/lib/action_view/partials.rb +++ b/actionpack/lib/action_view/partials.rb @@ -39,11 +39,11 @@ module ActionView render("#{path}/_#{partial_name}", { partial_name => object }.merge(local_assigns)) end - def render_collection_of_partials(partial_name, collection, partial_spacer_template = nil) + def render_collection_of_partials(partial_name, collection, partial_spacer_template = nil, local_assigns = {}) collection_of_partials = Array.new counter_name = partial_counter_name(partial_name) collection.each_with_index do |element, counter| - collection_of_partials.push(render_partial(partial_name, element, counter_name => counter)) + collection_of_partials.push(render_partial(partial_name, element, { counter_name => counter }.merge(local_assigns))) end return nil if collection_of_partials.empty?