Tracking user forum visits?

I want to implement the ability to track when users visist forums. So if
I have two forums each time the user visits them a record will be
created with the user name, forum id, and date/time. I am new to rails
and can think of a few ways of doing this, but I’m looking for an
easy/best practices way and was wondering what other people thought.

thanks,
-alex

Create a new model “TopicVisits”, with the fields “user_id”, “forum_id”
and “created_at”. Then add the following code to the end of the method
ForumController#forum in app/controllers/forum_controller.rb:
unless @user.guest?
TopicVisit.create(:user_id => @user.id, :forum_id => @forum.id)
end