aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-10-07 16:25:13 +0200
committerJosé Valim <jose.valim@gmail.com>2010-10-07 21:31:31 +0200
commit8f9e9118e402ea2fe1eec6fcb9a2d3f0c84b3b46 (patch)
treeb094e304f165535828b62d4fb2db3db9cc0e81c0 /actionpack/lib/action_view
parentb2600bfc181664fcfe448d100ca054017b0576dd (diff)
downloadrails-8f9e9118e402ea2fe1eec6fcb9a2d3f0c84b3b46.tar.gz
rails-8f9e9118e402ea2fe1eec6fcb9a2d3f0c84b3b46.tar.bz2
rails-8f9e9118e402ea2fe1eec6fcb9a2d3f0c84b3b46.zip
Make collection rendering faster.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/render/partials.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb
index 07e844afc2..f7bdbd6917 100644
--- a/actionpack/lib/action_view/render/partials.rb
+++ b/actionpack/lib/action_view/render/partials.rb
@@ -307,12 +307,12 @@ module ActionView
def collection_without_template
segments, locals, collection_data = [], @locals, @collection_data
- index, template = -1, nil
+ index, template, cache = -1, nil, {}
keys = @locals.keys
@collection.each_with_index do |object, i|
path, *data = collection_data[i]
- template = find_template(path, keys + data)
+ template = (cache[path] ||= find_template(path, keys + data))
locals[data[0]] = object
locals[data[1]] = (index += 1)
segments << template.render(@view, locals)