Topic: Counting User Profile Views

Hopefully this will be beneficial, in either that I will help someone in the same place, or I will be corrected for my foolish methods.

In my app I had need of being able to count user

Re: Counting User Profile Views

I would store it on a field in the users table and call it "profile_views", whenever the profile page is accessed I would call @user.increment!("profile_views")

To store which profiles that user has visited I would have a has_and_belongs_to on the users table which links to a table (can't think of a good name, so lets just call it profile_views at the moment). Everytime someone visits someone else's profile I would put it like @user.profile_views <<

Last edited by Radar (2007-08-30 02:20:38)