I have users that have many points and points belongs to users.
Points can be any amount.
I want to be kind to my db by adding a total points cache to my user model so I can easily just do user.total_points
how do I go about implementing this?
EDIT: PS I am adding points for the first time so there’s no need to go back and calculate points that users may have already earned…just need it going forward
You can use the
counter_cachetechnique if row in thepointstable constitutes one point. Otherwise you can implement it using a simpleafter_savefilter.