简体   繁体   English

将冰糕与纸迹相结合

[英]Integrating sorbet with paper-trail

When I try and add a has_paper_trail on any of my models to include versioning for objects created, Sorbet throws the following error:当我尝试在我的任何模型上添加has_paper_trail以包括创建对象的版本控制时,Sorbet 会引发以下错误:

app/models/model_name.rb:22: Method `has_paper_trail` does not exist on `T.class_of(<ModelName>)` https://srb.help/7003
    22 |  has_paper_trail

How do I fix this?我该如何解决?

I recently ran into the same issue.我最近遇到了同样的问题。 We're currently using the tapioca gem to generate RBI files on our project.我们目前正在使用木薯宝石在我们的项目中生成 RBI 文件。

In order to resolve this I added require 'paper_trail/frameworks/active_record' to sorbet/tapioca/require.rb file and ran bin/tapioca gem paper_trail to regenerate the RBI file for the paper_trail gem.为了解决这个问题,我在 sorbet/tapioca sorbet/tapioca/require.rb文件中添加了require 'paper_trail/frameworks/active_record'并运行bin/tapioca gem paper_trail以重新生成 paper_trail gem 的 RBI 文件。

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM