使用Rails Audited gem,我想拥有一个包含所有更新的友好,人类可读的日志文件。
有没有办法轻松做到这一点?
答案 0 :(得分:1)
您可以利用此选项from the doc:
class CustomAudit < Audited::Audit
after_commit :custom_log
def custom_log
# do what you need here with attributes
end
end
# Then set it in an initializer like config/initializers/audited.rb
Audited.config do |config|
config.audit_class = CustomAudit
end