Skip to content

Commit

Permalink
Revert 'bc5896e'
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Jul 23, 2008
1 parent 97a954b commit e0db925
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 0 additions & 3 deletions actionpack/lib/action_view/base.rb
Expand Up @@ -332,9 +332,6 @@ def pick_template(template_path)
end end
end end


extend ActiveSupport::Memoizable
memoize :pick_template

private private
# Renders the template present at <tt>template_path</tt>. The hash in <tt>local_assigns</tt> # Renders the template present at <tt>template_path</tt>. The hash in <tt>local_assigns</tt>
# is made available as local variables. # is made available as local variables.
Expand Down
9 changes: 4 additions & 5 deletions actionpack/lib/action_view/partials.rb
Expand Up @@ -102,8 +102,6 @@ module ActionView
# #
# As you can see, the <tt>:locals</tt> hash is shared between both the partial and its layout. # As you can see, the <tt>:locals</tt> hash is shared between both the partial and its layout.
module Partials module Partials
extend ActiveSupport::Memoizable

private private
def render_partial(partial_path, object_assigns = nil, local_assigns = {}) #:nodoc: def render_partial(partial_path, object_assigns = nil, local_assigns = {}) #:nodoc:
local_assigns ||= {} local_assigns ||= {}
Expand Down Expand Up @@ -131,12 +129,14 @@ def render_partial_collection(partial_path, collection, partial_spacer_template


local_assigns = local_assigns ? local_assigns.clone : {} local_assigns = local_assigns ? local_assigns.clone : {}
spacer = partial_spacer_template ? render(:partial => partial_spacer_template) : '' spacer = partial_spacer_template ? render(:partial => partial_spacer_template) : ''
_paths = {}
_templates = {}


index = 0 index = 0
collection.map do |object| collection.map do |object|
_partial_path ||= partial_path || ActionController::RecordIdentifier.partial_path(object, controller.class.controller_path) _partial_path ||= partial_path || ActionController::RecordIdentifier.partial_path(object, controller.class.controller_path)
path = find_partial_path(_partial_path) path = _paths[_partial_path] ||= find_partial_path(_partial_path)
template = pick_template(path) template = _templates[path] ||= pick_template(path)
local_assigns[template.counter_name] = index local_assigns[template.counter_name] = index
result = template.render_partial(self, object, local_assigns, as) result = template.render_partial(self, object, local_assigns, as)
index += 1 index += 1
Expand All @@ -153,6 +153,5 @@ def find_partial_path(partial_path)
"_#{partial_path}" "_#{partial_path}"
end end
end end
memoize :find_partial_path
end end
end end

0 comments on commit e0db925

Please sign in to comment.