Object with two counter caches

Hi everyone,

Does anyone know if it’s possible/supported to have an object with two
counter caches? I have an object that’s defined like this:

class Bookmark < ActiveRecord::Base
belongs_to :user, :counter_cache=>true
belongs_to :gift, :counter_cache=>true

And I’m trying to figure out the syntax I can use which, when I create a
bookmark, will update both counter caches. Right now I’m doing this:

agift.bookmarks.create(:user_id=>self.id)

And I’m seeing that it updates the user counter cache
(users.bookmarks_count) but it isn’t updating the gift counter cache
(gifts.bookmarks_count).

Has anyone done this before, or does anyone know a good way I can get
this to work?

Thanks!

Tom