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?