Open westonganger opened 1 year ago
Seems to me that this should be easy to do. Disclaimer, I just whipped this up quickly, its totally untested.
class MyRecord
has_snapshot_children do
...
end
end
MyRecord.all.each do |record|
record.versions.each do |version|
### Use whatever options are applicable here
reified_record = version.reify(
has_many: true,
has_one: true,
belongs_to: false,
)
snapshot_identifier = "#{version.updated_at}"
user = User.find(version.whodunnit) if version.whodunnit
reified_record.create_snapshot(
identifier: snapshot_identifier,
user: user,
metadata: {
info: "Migrated from paper_trail-association_tracking"
}
)
end
end
This question was raised in another thread, https://github.com/westonganger/active_snapshot/issues/14#issuecomment-1234237716