AuditGroup
Group ActiveRecord operations together by assigning all of their audits the same request_uuid.
Requirements
- Audited gem
Installation
From RubyGems.org
Globally
gem i omg-audit-groupIn Gemfile
gem 'omg-audit-group'Testing locally
# Build gem
rake build
# Install gem
## From this directory
rake install
## From other directory
gem i -l /path/to/this/folder/omg-audit-group-0.1.0.gemUsage
Load the gem
require 'audit_group'Using class methods
# Group operations under the same request_uuid
AuditGroup.request { perform_some_operations }
# View the last request_uuid
AuditGroup.request_uuid
# View the audits from the last request
AuditGroup.audits
# Save the AuditGroup instance for later
audit_group = AuditGroup.currentSaving Request object for later use
# Group operations under the same request_uuid
audit_group = AuditGroup.request { perform_some_operations }
# View the last request_uuid
audit_group.request_uuid
# View the audits from the last request
audit_group.auditsPassing in a request_uuid
AuditGroup.request(request_uuid: some_record.audits.last.request_uuid)Performing a dry run
View how records would change without committing the transaction
audit_group = AuditGroup.request(dry_run: true) { perform_some_operations }
audit_group.auditsRunning tests
bundle exec rspec # option 1
rake spec # option 2
rspec # option 3