I often find myself find my self doing something like this:
<%= render :partial => ''products'', :collection =>
@products, :locals
=> {:collection_size => @products.size} %>
Usually when I need to identify the last item so I can give it a
specific class.
I figured it would be much more useful if the collection size was
automatically assigned as a local variable in the same way the counter
is.
Here''s a patch that does just that.
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/836-assign-collection_size-local-variable-in-partials
It also assigns a counter based on the :as option if it''s set.
Tekin Suleyman
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---