I have a has_many :through relationship associating players to teams THROUGH managements.
I want to have a counter on the teams table (a bit like a counter cache) that tells me how many new associations there have been since the beginning of the week. Of course a counter cache wont work because it will always give all the associations that were ever created.
I've tried updating the associated team from within the managements model. This never succeeds. Even though the increment to the associated team appears to be saved OK, after the association is created my counter is still 0.
I also tried using an observer. The observer got called as I expected, I was able to retrieve the team, but any updates to it, again, were not saved.
I'm sure I'm missing something obvious! What is the rails way to implement this?
I setup a github to illustrate the problem, running rake spec will fail.