Counter_cache and updates

I’m trying to figure out how to use counter_cache.

I’ve got Clients that have many Profiles. And I got things working so
that
when I add a new Profile, the profiles_count gets updated.

profile = client.profiles.new(params[:profile])
profile.save

However, I’m stuck trying to figure out how to deal with UPDATING a
profile
(moving it to a different Client). If I change the profile to a new
client,
I can get the right profiles_count on the NEW client, but the OLD client
is
not updated (to reflect one fewer profile)

Anyone have any suggestion? I’ve been surprised at how little
information
I’ve found about using couter_cache. Any good, thorough tutorials out
there?

Thanks,

Eric

View this message in context:
http://www.nabble.com/counter_cache-and-updates-t1435328.html#a3873241
Sent from the RubyOnRails Users forum at Nabble.com.