-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to migrate existing application from paper_trail to active_snapshot #28
Labels
documentation
Improvements or additions to documentation
Comments
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 |
westonganger
added
documentation
Improvements or additions to documentation
question
Further information is requested
and removed
question
Further information is requested
labels
Sep 17, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This question was raised in another thread, #14 (comment)
The text was updated successfully, but these errors were encountered: