Added fourth argument to render_collection_of_partials that allows you to...

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
上级 79365a01
*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]
......
......@@ -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?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册