[英]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. 我在Rails 3应用程序中使用了paper_trail几个模型,但是在尝试将其应用于联接模型时遇到了障碍-它的主键不是id。
I checked the doc and the source but couldn't see any options to override the use of id. 我检查了文档和源,但看不到任何替代ID的选项。 Any suggestions?
有什么建议么?
The simplest fix is just to add a method, id, that references the primary key. 最简单的解决方法是添加引用主键的方法id。 Once paper_trail has that it's happy.
一旦paper_trail拥有了它,那就很高兴。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.