Group ActiveRecord operations together by assigning all of their audits the same request_uuid
.
- Audited gem
gem i omg-audit-group
gem 'omg-audit-group'
# 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.gem
require 'audit_group'
# 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.current
# 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.audits
AuditGroup.request(request_uuid: some_record.audits.last.request_uuid)
View how records would change without committing the transaction
audit_group = AuditGroup.request(dry_run: true) { perform_some_operations }
audit_group.audits
bundle exec rspec # option 1
rake spec # option 2
rspec # option 3