W
Woga Swoga
I have an list of objects (Candy) and each object has two fields
(Candy.color, Candy.taste). I would like to display the candies but
group them based on the fields (display a header for each group). The
problem is I don't know how many colors or tastes are in any particular
list of candies.
This is what I have for input:
* Candy <-- hash list already pre-sorted by "group"
* group <-- variable contains either "color" or "taste"
Can anyone come up with a ruby code snipet that will use the "group"
variable to extract out the group labels (unique values of the color or
tate field), and then dump out the Candy list by group.
Really appreciate your help!
(Candy.color, Candy.taste). I would like to display the candies but
group them based on the fields (display a header for each group). The
problem is I don't know how many colors or tastes are in any particular
list of candies.
This is what I have for input:
* Candy <-- hash list already pre-sorted by "group"
* group <-- variable contains either "color" or "taste"
Can anyone come up with a ruby code snipet that will use the "group"
variable to extract out the group labels (unique values of the color or
tate field), and then dump out the Candy list by group.
Really appreciate your help!