lib/zuora_connect/zuora_audit.rb
# Added by @Vina # Description: This automatically stamp user created/updated the record for DataQuery Audit # Usage: add 'zuora_audit' to your model.rb that you would like to track module ZuoraConnect module ZuoraAudit extend ActiveSupport::Concern module ClassMethods def zuora_audit include ZuoraConnect::ZuoraAudit::ZuoraAuditInstanceMethods before_create :set_created_by_id before_update :set_updated_by_id end end module ZuoraAuditInstanceMethods def set_created_by_id self.created_by_id = current_user_id if defined?(self.created_by_id) end def set_updated_by_id self.updated_by_id = current_user_id if defined?(self.updated_by_id) end def current_user_id return ZuoraConnect::ZuoraUser.current_user_id end end end end