# add to your Gemfile, and run bundle install to install it
gem "audited"
# install table for audited gem operation
rails generate audited:install
rails db:migrate
# open your model that you want to audited
class Client < ApplicationRecord
audit
end
# restart rails server
# how to check the action
@client = Client.first
@audits = @client.audits
if @audits
@audits.each do |audit|
if audit.user
audit.user.username
audit.action
end
end
end