This project is archived and is in readonly mode.
PATCH: assign collection counter local variable in partials based on the :as option
-
Tekin
Great minds!
-
Tom Ward
Might it be nicer to automatically provide a helper method/instance variable to indicate whether the first or last records in the collection are being passed?
-
Tekin
I guess so. In fact, Michael's patch does just that!
I've combined Michael's patch with mine, attached.
-
DHH
- State changed from new to wontfix
I'm really not a fan of this auto-setting of locals. I think setting the counter local is already kinda fishy, but at least it's something that would otherwise be kinda hard. Setting the size of the collection is perfectly doable through current means, so I don't think it's worth the magic spell to do it automatically.
You're of course always free to turn it into a plugin ;)
-
Tekin
- Title changed from PATCH: assign collection_size local variable in partials to PATCH: assign collection counter local variable in partials based on the :as option
A small part of the patch might still be worth keeping though - the part that creates a counter based on the :as parameter. It doesn't feel right that specifying the :as option doesn't set "#{:as}_counter". I've attached another patch.
