So, I have two models, User and Thing.
User
has_many :things
end
Thing
belongs_to :user
end
Thing
has a date associated with it. A user might add zero things one day, and 4 the next, and 7 the day after that, then zero for a few days. You get the idea.
Now, what I'd like to get is an array of values for the last 7 days. How many things did a user add? I want to make sure that it includes zeros for days where nothing was added. For example, it might return [0, 4, 7, 0, 0, 11, 2]
.
This is yet another example of something I'm sure is reasonably easy to do, but my google-fu is failing me. :-)
Thanks!