简体   繁体   English

为什么 Paper Trail 的变更集为空?

[英]Why is changeset for Paper Trail empty?

I recently upgraded my Ruby to 3.1.2 and Rails to 7.0.3.1.我最近将 Ruby 升级到 3.1.2,Rails 升级到 7.0.3.1。

Somewhere in the changes, one problem I noticed is that my Paper Trails (paper_trails gem) info was now not working, at least with respect to the details.在更改的某个地方,我注意到的一个问题是我的 Paper Trails (paper_trails gem) 信息现在无法正常工作,至少在细节方面是这样。

None of the "changeset" data was available, as so my tests were failing.没有可用的“变更集”数据,因此我的测试失败了。

I put a "byebug" in the view that used the data and looked for what was missing.我在使用数据的视图中放置了一个“byebug”并查找丢失的内容。 Apparently my "changeset" data was all missing.显然我的“变更集”数据都丢失了。

Using this link:使用此链接:

Upgrading to Rails 6.1.6.1 causes Psych::DisallowedClass: Tried to load unspecified class: Symbol 升级到 Rails 6.1.6.1 导致 Psych::DisallowedClass: 试图加载未指定的 class: 符号

And these:还有这些:

https://github.com/paper-trail-gem/paper_trail/issues/446 https://github.com/paper-trail-gem/paper_trail/issues/446

https://github.com/ruby/psych/issues/490 https://github.com/ruby/psych/issues/490

I guessed it was a disallowed class problem, and I ultimately sat on that view breakpoint running我猜这是一个不允许的 class 问题,我最终坐在那个视图断点上运行

PaperTrail.serializer.load(change_history_by_month.object_changes) (your parameter will be different of course) PaperTrail.serializer.load(change_history_by_month.object_changes) (您的参数当然会有所不同)

until it output the right data.直到它 output 正确的数据。 The basic problem apparently was Pysch, and several disallowed classes (for example, "Psych::DisallowedClass Exception: Tried to load unspecified class: BigDecimal"), but fortunately the above will tell you the classes and you can add them to config/application.rb基本问题显然是 Pysch 和几个不允许的类(例如,“Psych::DisallowedClass Exception: Tried to load unspecified class: BigDecimal”),但幸运的是上面会告诉你这些类,你可以将它们添加到配置/应用程序.rb

Very frustrating as it was all quiet, without warnings or errors.非常令人沮丧,因为一切都很安静,没有警告或错误。

Of course, the classes aren't disallowed for nothing.当然,这些课程并不是无缘无故被禁止的。 There may be a security problem here with allowing these classes.允许这些类可能存在安全问题。

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

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