Using paper_trail with a class whose primary key is not 'id'
-
28-02-2021 - |
Domanda
I've used paper_trail for a couple of models in my rails 3 app but I've hit a snag when trying to apply it to a join model - its primary key is not id.
I checked the doc and the source but couldn't see any options to override the use of id. Any suggestions?
Soluzione
The simplest fix is just to add a method, id, that references the primary key. Once paper_trail has that it's happy.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow