Skip to content

Commit

Permalink
Make collection rendering faster.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Oct 7, 2010
1 parent b2600bf commit 8f9e911
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/abstract_controller/rendering.rb
Expand Up @@ -50,7 +50,7 @@ def view_context_class
if controller.respond_to?(:_helpers)
include controller._helpers

if controller.respond_to?(:_routes)
if controller.respond_to?(:_routes) && controller._routes
include controller._routes.url_helpers
include controller._routes.mounted_helpers
end
Expand Down
4 changes: 2 additions & 2 deletions actionpack/lib/action_view/render/partials.rb
Expand Up @@ -307,12 +307,12 @@ def collection_with_template

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)
Expand Down

0 comments on commit 8f9e911

Please sign in to comment.