From e524327e510996ad741ba44c5403fe7353519e40 Mon Sep 17 00:00:00 2001 From: Matthew Eagar Date: Tue, 24 Jan 2017 20:40:34 -0500 Subject: Add partial iteration variable to template keys When rendering heterogeneous collection using `render @collection` or `render partial: @collection`, the expected `_iteration` variable is missing due to `find_template` not having the name of the iteration variable included in its cache keys. --- actionview/lib/action_view/renderer/partial_renderer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb index 2bb4465131..647b15ea94 100644 --- a/actionview/lib/action_view/renderer/partial_renderer.rb +++ b/actionview/lib/action_view/renderer/partial_renderer.rb @@ -458,7 +458,7 @@ module ActionView locals[counter] = index locals[iteration] = partial_iteration - template = (cache[path] ||= find_template(path, keys + [as, counter])) + template = (cache[path] ||= find_template(path, keys + [as, counter, iteration])) content = template.render(view, locals) partial_iteration.iterate! content -- cgit v1.2.3