This project is archived and is in readonly mode.

#2804 ✓resolved
graham (at votary)

Partial collection counter variable improperly named using :as

Reported by graham (at votary) | June 16th, 2009 @ 01:13 AM | in 2.3.6

This is my first bug submission, so please forgive any deviations from protocol.

It seems that the :as option doesn't affect the counter variable name when rendering a collection. Here is an example.

From a brand new 2.3.2 app...


# [ApplicationController#index]

<% @cheesecakes = %w(strawberry chocolate graham-cracker) %>
<%= render :partial => "item", :collection => @cheesecakes, :as => :cheesecake %>

# [application/_item.html.erb]

<%= "#{item_counter+1} #{cheesecake}" %>
</br>
[OUTPUT]

1 strawberry 
2 chocolate 
3 graham-cracker

Should this "item_counter" not be "cheesecake_counter"? Instead "cheesecake_counter" does not exist.

undefined local variable or method `cheesecake_counter'

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages