Is there any gem which can be used to store user log in DB for rails 3.2?

71 Views Asked by At

Is there any gem which can be used to store user log ? Following is the list which I want to store:

  • User IP
  • URL which user has hit.
  • Amount of time user is on that page
  • Sign in time
  • Sign out time
  • Total time user has spend in that complete session i.e, time difference between sign in and sign out.

My rails version is 3.2.21. I have checked "Paper trail" and "Public activity" I think first one is helpful for versioning and the later one is one for user news feed. I also checked Fnordmetric but it is used only to track the urls which user had hit. Here I want to store above mentioned list in my log.

I also checked AHOY. I was told it will work properly only on rails4.

Please suggest which one I should use. Thanks in advance.

2

There are 2 best solutions below

0
On

Personally, I would have chosen ahoy anyway.

The reason you can use this is because,

  1. This satisfies most of your demands.
  2. If the gem version is not compatible with your rails version, you can either use Ahoy.js or you can pick a previous version that is compatible with your rails version.

P.S: I would still suggest that you give the current version a try. I don't think of any issues using that.

0
On

https://github.com/airblade/paper_trail

Its main prupose is to versioning models but I think its also good for your use case since it registers who made each version.

For more gems search at ruby toolbox. Here are the categoties that you should check in this case

https://www.ruby-toolbox.com/categories/Active_Record_User_Stamping

https://www.ruby-toolbox.com/categories/Active_Record_Versioning

Maybe Userstamp is actually better for your use case.

You can also try this one https://github.com/collectiveidea/audited