Hi all,
I had been searching and reading for user action logging in Rails 3 and didn’t came out with something that looks like the way to take for sure.
Does anyone know a gem or have any recommendation about the best way to do this?
The idea is to log the user, date and time information, the controller and action in almost all the actions.
Thanks.
you can do it by yourself.. just create before_filter, place into your application controller and store controller_name and action or any other values
assume you have some db table with user logging
class ApplicationController < ActionController::Base
before_filter :log_user
private
def log_user
UserLog.create(
:user => current_user,
:controller_name = controller_name,
:action => action_name
)
end
end
you can store your params as well (eg. serialize into YAML)
tom
Thanks Tom, thats the approach I had in mind but didn’t know for sure if there was already something or if it was a good way to go.
Will follow your indications.