I'm using the gem audited in my rails app, and I'm wondering if it's possible to add auditing of actions other than create, update and destroy..?
ALternatively, maybe someone can point me to another gem that supports this, since I need to track all kinds of access to the app.
Thanks
I found a way around the issue, that, although not ideal for all, meets the requirements for my little application.
I added a class Audit that just looks like this:
class Audit < ActiveRecord::Base
belongs_to :user
end
And then I added this to the ApplicationController
after_action only: :show do |c|
a = Audit.new
a[:auditable_id] = params[:id]
a[:auditable_type] = self.class.to_s.gsub(/^(.+)sController/, '\1')
a[:user_id] = current_user.id
a[:user_type] = 'User'
a[:action] = 'show'
a[:comment] = "url fullpath: #{request.original_fullpath}"
a[:remote_address] = request.remote_ip
a[:request_uuid] = request.uuid
a.save
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With