managing visits

Hey all,
I have Users and Products, I would like to log every time a user visit
a product page.
I have:
users(id, name)
what's the best way to do this? is it:
with user has_many :visits
and visit belongs_to :user
and product has_many :visits

with user has_many :visits through products
but I'm not sure how to manage that one

any idea?

thanx in advance


You could use a before_filter or after_filter on the product page
actions to create a new AR object and save it to the DB.


thanx Jeremy but I wanted to know DBwise how to manage visits.

sounds like you need a products_users HABTM table with a visits field that you can update on each visit. As jeremy stated, you could handle this in a before_filter or in the actual action for the show product page.