rubyruby-on-rails-3paper-trail-gem

How to track custom events in paper_trail?


I am using paper_trail for audit trail. Along with create, update and delete events I want to track few custom events like view(record), sent(email) etc. How can we introduce such custom events while auditing a model?


Solution

  • I have found a tweak to add custom events in paper_trail managed Versions:

    Version.create(item_type: "Campaign", item_id: campaign.id, event: "Sent")
    

    Maybe this is not right solution, but it helped me to achieve the goal. I would like to explore paper_trail more to find a better solution.