I'm working on switching from vestal_version to paper_trail.
I know vestal versions use versions number while paper_trails use timestamps.
我正在努力从vestal_version切换到paper_trail。我知道vestal版本使用版本号,而paper_trails使用时间戳。
paper_trails
has a method called version_at(timestamp)
, but I found a lot of versions in my table with the same exact date so that method will not work as expected.
paper_trails有一个名为version_at(timestamp)的方法,但我发现我的表中有很多版本具有相同的确切日期,因此该方法无法按预期工作。
I need to achieve the following.
我需要实现以下目标。
widget1 = widget.paper_trail.version(4)
widget2 = widget.paper_trail.version(10)
# there are a couple of way to get the diff
# using active record diff ( I prefer this to Jeremy Weiskotten's PaperTrail)
changes = widget1.diff(widget2)
# I know I can do
versions = widget.versions[4]
# that only returns versions model instead of widget
Thanks for the help
谢谢您的帮助
1 个解决方案
#1
1
you will have to do reify
to get the widget object
你将不得不做reify来获取widget对象
widget.versions[4].reify
Find documentation and examples here
在此查找文档和示例
#1
1
you will have to do reify
to get the widget object
你将不得不做reify来获取widget对象
widget.versions[4].reify
Find documentation and examples here
在此查找文档和示例