In my program, I have a model, Calorie, that takes what a person ate and gives them a point total. After that point value is calculated for each day\'s nutritional information,
I'm assuming your Calorie model has a has_one relationship with the User, and User has_many Calories.
In Calorie model:
after_save :update_user_points
def update_user_points
self.user.update_calorie_points!
end
In User model:
def update_calorie_points!
self.update_column(:points, self.calories.sum(:points))
end