Skip to content

runeleaf/audit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

= Audit

Instllation

Add this line to your application's Gemfile:

  gem 'audit', github: 'runeleaf/audit'

Download and install by running:

> bundle install

Generators

> rails g audit:migration

Usage TODO:

> rails g audit:migration
> rake db:migrate

Model:

class Post < ActiveRecord::Base
  audit_log
...
end

method:

Post.transcribe user: current_user, view_name: 'test', action_name: 'posts#create', crud_name: 'search'
Post.auditable #=> [#<Audit::AuditLog>]

Callbacks:

class Post < ActiveRecord::Base
  audit_log force: true
...
end

save or create:

post = Post.new title: 'test'
post.save
post.audits #=> [#<Audit::AuditLog>]

update:

post = Post.first
post.save
post.audits #=> [#<Audit::AuditLog>, #<Audit::AuditLog>]

post.transcribe user: current_user, view_name: 'test', action_name: 'posts#update', crud_name: 'update'
post.audits #=> [#<Audit::AuditLog>, #<Audit::AuditLog>, #<Audit::AuditLog>]

destroy:

post = Post.first
post.destroy
post.audits #=> [#<Audit::AuditLog>, #<Audit::AuditLog>, #<Audit::AuditLog>, #<Audit::AuditLog>]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages