Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added fourth argument to render_collection_of_partials that allows yo…

…u 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
  • Loading branch information...
commit 98c16a3320c8f018b6c30a54f61743c540c517f4 1 parent 79365a0
David Heinemeier Hansson dhh authored
Showing with 4 additions and 2 deletions.
  1. +2 −0  actionpack/CHANGELOG
  2. +2 −2 actionpack/lib/action_view/partials.rb
2  actionpack/CHANGELOG
View
@@ -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]
4 actionpack/lib/action_view/partials.rb
View
@@ -39,11 +39,11 @@ def render_partial(partial_path, object = nil, local_assigns = {})
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?
Please sign in to comment.
Something went wrong with that request. Please try again.