Topic: How to track user activity in a rails3 + devise app?

I need an activity table which tracks user activities for various things like analytics, social features ( clicks on items are votes), security, debugging, etc.

To enable this, In my rails (3.2.3) app with devise (2), I want to have a table that stores all the activity of currently signed in user at the model and controller level. My Activities table has columns model, id, action (create, read, update, destroy, get), actor (logged in user) and ip (ip address of originating computer).

The problem with designing the solution is due to the MVC separation of concerns. If I use an observer, I can track all model level activities, but cannot get the current user or ip. If I use an application filter, I can get user and ip info, but in order to really know if (for example) a record was saved, I have to insert code near the (for example) model.save! call within each action of each controller.

What is the best way to implement this?

Re: How to track user activity in a rails3 + devise app?

There are various acts as audit gems available on git hub. Some more maintained than others. I suggest you have a trawl through and see which one best suits your needs

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)