Forum: Ruby on Rails counter_cache and updates

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
etlund (Guest)
on 2006-04-12 04:06
(Received via mailing list)
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-t1...
Sent from the RubyOnRails Users forum at Nabble.com.
This topic is locked and can not be replied to.