-
Notifications
You must be signed in to change notification settings - Fork 895
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
touch_with_version does not work with conditional options #1051
Comments
Turns out this is also true with the Currently my workaround involves creating new classes that inherit from the parent class and simply have How can I create a new version regardless of any of the options when using |
Hi Weston, The docs say for
The Here's what I'm seeing when I run your script: has_paper_trail # pass
has_paper_trail on: [:update] # pass
has_paper_trail only: [:first_name] # fail
has_paper_trail on: [:update], only: [:first_name] # fail It seems Please take it from here and prepare a PR with a fix and new tests, thanks. |
After investigating, the cause of this problem is in
This bug would effect all of the conditional options I tried skipping the I will continue to work on adding that logic within that method. However, please let me know if theres a better way I can go about this. |
Instead of recreating all the logic I thought it might be easier to just wrap the save call in a record_update(true)
@record.paper_trail.without_versioning do
@record.save!(validate: false)
end This fixed everything and all tests passed except for one test regarding enum'sin Rails 5.1. Related to this PR https://github.com/airblade/paper_trail/pull/846/files#diff-b231cea2817ec877c717184b869a5f74 |
Fixed by #1053, will release in 9.0.0. |
touch_with_version
is not working correctly with theon
andonly
options combined. Howevertouch_with_version
works fine with both options seperately. For example:With this in the model, after running
touch_with_version
runs and doesn't error but no version is created.The text was updated successfully, but these errors were encountered: