2

I'm using Audited gem for rails and auditing reocrds for one of my model and everything works fine but auditable_id is going nil in audits table. This is happening because id of the object i'm auditing is int and audits table store auditable_id as uuid. So how can i resolve this issue? I tried following but i don't think this is a right way.

Audited.audit_class.as_user(current_user) do
    model.update()        
    audit = Audited::Audit.last
    audit.update(auditable_id: id.to_s.rjust(32,"0"))    
  end

above code does the work but i don't feel this is a right way to do it. There must be some way to do it in better way.

Manoj
  • 68
  • 1
  • 6

0 Answers0