-
Notifications
You must be signed in to change notification settings - Fork 899
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
Manually creating a version saves the object with nil attributes #1047
Comments
Thanks for the bug report. Per our contributing guide please use |
Are you still working on this? Want me to keep it open? |
I am able to reproduce the issue, I was wondering if this is intentional like the issue #43.
|
Hi Abhinav, Interesting. The documentation for
It doesn't say anything about what goes in the version record, so we expect it to work the same as any other "update" As a workaround, you could install the update callback, -has_paper_trail on: []
+has_paper_trail on: [:update] I'm not sure what the real fix for this problem should be. Any ideas? |
Ah. I see that #1048 is your suggestion. |
Fixes #1047 Fixes touch_with_version when the update callback is not installed, eg. `has_paper_trail(on: [])`
Fixes #1047 Fixes touch_with_version when the update callback is not installed, eg. `has_paper_trail(on: [])`
Fixed by #1060, will release as 9.0.0. |
Fixes paper-trail-gem#1047 Fixes touch_with_version when the update callback is not installed, eg. `has_paper_trail(on: [])`
Fixes paper-trail-gem#1047 Fixes touch_with_version when the update callback is not installed, eg. `has_paper_trail(on: [])`
I'm using rails 5.1 with postgres database.
My use case involves creating versions when I explicitly want to instead of on callbacks like
on: [:update]
or something.I did so by adding
on: []
in mymy_model.rb
and usingpaper_trail.touch_with_version
on my model instance. The problem is whenever I do this the first time the version is saved withnil
attributes. Weird enough, the next time callpaper_trail.touch_with_version
it saves it correctly with all attributes correctly initialised.Sample logs from my rails console:
The text was updated successfully, but these errors were encountered: