简体   繁体   中英

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:

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.

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.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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