Search code examples
ruby-on-railsrubygemspaper-trail-gem

Using paper_trail with a class whose primary key is not 'id'


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?


Solution

  • The simplest fix is just to add a method, id, that references the primary key. Once paper_trail has that it's happy.