Forum: Ruby on Rails acts_as_versioned - summing prior records

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D26ab4f98a07ce0fb893c828d6d8d7c6?d=identicon&s=25 Dylan Markow (Guest)
on 2007-01-29 06:23
We have a table of users, each user having a monthly "goal" number. As a
company, we need a snapshot of the combined goal of all users. However,
we also need to be able to go back in time and see what a goal was for a
specific month. Since our "users" table is versioned, I know the data is

However, for a specific date, I'm having trouble avoiding a separate
query for each user's goal, mainly because there are many other fields
in the users table causing each user to have multiple versions within a
month. So if user A has 10 different versions for January, summing up
the goals for January will count that user's goal 10 times.

Any suggestions? Thank you!
This topic is locked and can not be replied to.