1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
David Heinemeier Hansson 2005-01-11 00:27:33 +00:00
parent 79365a0184
commit 98c16a3320
2 changed files with 4 additions and 2 deletions

View file

@ -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]

View file

@ -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?