diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-04-26 20:47:22 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-04-29 14:45:06 -0300 |
commit | 0568fb5b9efa6923e9407552aae46b0a1210539d (patch) | |
tree | 986a02b68834fd100b0ece552088f6e00f6a6b3e /actionpack/lib/action_view/renderer | |
parent | d0c9c93c4a3a7da27ab8d9f53811960309f8e18f (diff) | |
download | rails-0568fb5b9efa6923e9407552aae46b0a1210539d.tar.gz rails-0568fb5b9efa6923e9407552aae46b0a1210539d.tar.bz2 rails-0568fb5b9efa6923e9407552aae46b0a1210539d.zip |
Allow access to current object_counter variable from layout when rendering with partial + collection
Diffstat (limited to 'actionpack/lib/action_view/renderer')
-rw-r--r-- | actionpack/lib/action_view/renderer/partial_renderer.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb index c7765732c7..e2b5e8e36e 100644 --- a/actionpack/lib/action_view/renderer/partial_renderer.rb +++ b/actionpack/lib/action_view/renderer/partial_renderer.rb @@ -283,7 +283,7 @@ module ActionView end if layout = @options[:layout] - layout = find_template(layout, @locals.keys + [@variable]) + layout = find_template(layout, @locals.keys + [@variable, @variable_counter]) end result = @template ? collection_with_template : collection_without_template @@ -292,6 +292,7 @@ module ActionView locals = @locals result.map! do |content| locals[@variable] = @collection[result.index(content)] + locals[@variable_counter] = result.index(content) layout.render(@view, @locals) { content } end end |