collectiveidea / audited

Audited (formerly acts_as_audited) is an ORM extension that logs all changes to your Rails models.
MIT License
3.39k stars 682 forks source link

Auditing models with UUID pk #361

Open SampsonCrowley opened 7 years ago

SampsonCrowley commented 7 years ago

How would I go about auditing models that have a UUID pk in audited? the docs show how to set user_id as uuid but not auditable_id.

if i had a mix of both uuid based models and integer pk models, how would i set up separate auditors?( e.g. on that's just for the uuid models)

zhitongLBN commented 7 years ago

@SampsonCrowley I've the same pb, when i'm using UUID pk objet. In my case, auditable_idget 0 sometime, and some of my new created object got revisions at the beginning. I've to change the column auditable_id to type uuid for instance to make it work(is a hack for sure)

holmes2 commented 6 years ago

@zhitongLBN @SampsonCrowley Did you try making the auditable_id as string type in migrations ? If you did that already, did you face any issues related to making it string ?

fabianoarruda commented 5 years ago

The solution proposed by @holmes2 worked for me. Didn't face any issues by changing auditable_id type to string.

SampsonCrowley commented 5 years ago

@fabianoarruda glad it worked! I stopped using this repo a long time ago in favor of DB level auditing