是否可以将 PaperTrail gem 配置为全局忽略属性?

Is it possible to configure PaperTrail gem to ignore attributes globally?

PaperTrail gem docs state that you can configure individual models to ignore some attributes -- 这很好用,但我想跳过所有 updated_at 属性(在每个模型中)。有没有办法全局执行此操作(在初始化程序中?)。像 PaperTrail.config.ignore = [:updated_at]

Related question: Is there a list of global configuration options for the PaperTrail gem?

目前(2017 年 1 月)PaperTrail 中没有全局模型配置。您可以使用全局常量来执行此操作。

# config/initializers/global_constants.rb
GLOBAL_PT_IGNORE = [:updated_at]

# app/models/foo.rb
has_paper_trail(ignore: GLOBAL_PT_IGNORE + [:banana])

# app/models/bar.rb
has_paper_trail(ignore: GLOBAL_PT_IGNORE + [:kiwi, :mango])