I’m trying to group records based on some attribute they or an
association of their’s have. The simplest example I could think of to
drive my point is this:
Assume the following model associations (pardon my butchering of rails)
The first example groups by an attribute (in the above case, “day”).
Try it in script/console first to see how the data structure is
returned. It’s a nested array of key, values where the key is the
attribute and the value is an array of records that are in that group.
You can iterate through it with the each call as in that example.
HTH!
-Danimal
P.S. I’ve used group by with will_paginate and it works just fine