提交 e0db925b 编写于 作者: J Joshua Peek

Revert 'bc5896e7'

上级 97a954bf
......@@ -332,9 +332,6 @@ def pick_template(template_path)
end
end
extend ActiveSupport::Memoizable
memoize :pick_template
private
# Renders the template present at <tt>template_path</tt>. The hash in <tt>local_assigns</tt>
# is made available as local variables.
......
......@@ -102,8 +102,6 @@ module ActionView
#
# As you can see, the <tt>:locals</tt> hash is shared between both the partial and its layout.
module Partials
extend ActiveSupport::Memoizable
private
def render_partial(partial_path, object_assigns = nil, local_assigns = {}) #:nodoc:
local_assigns ||= {}
......@@ -131,12 +129,14 @@ def render_partial_collection(partial_path, collection, partial_spacer_template
local_assigns = local_assigns ? local_assigns.clone : {}
spacer = partial_spacer_template ? render(:partial => partial_spacer_template) : ''
_paths = {}
_templates = {}
index = 0
collection.map do |object|
_partial_path ||= partial_path || ActionController::RecordIdentifier.partial_path(object, controller.class.controller_path)
path = find_partial_path(_partial_path)
template = pick_template(path)
path = _paths[_partial_path] ||= find_partial_path(_partial_path)
template = _templates[path] ||= pick_template(path)
local_assigns[template.counter_name] = index
result = template.render_partial(self, object, local_assigns, as)
index += 1
......@@ -153,6 +153,5 @@ def find_partial_path(partial_path)
"_#{partial_path}"
end
end
memoize :find_partial_path
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册