Skip to content
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

Avoid adding the version attribute to deleted docs #249

Merged
merged 2 commits into from
Dec 17, 2020

Conversation

dgknght
Copy link
Contributor

@dgknght dgknght commented Dec 17, 2020

This is a follow up to this PR.

Adding the version attribute to a deleted embedded document is causing an update conflict, which mongoid ultimately applies after the removal of the document, creating an empty document with only the version attribute.

I had to relax a couple of the rubocop constraints in order to fit these changes in.

Also, there was another change in integration_spec.rb that appears unrelated. After making the change in trackable.rb, the specs started failing because, while the history_tracks method was returning a new array with an additional member, the last method was continuing to return the same record. Addressing the last member of the array by index avoids the issue.

Doug Knight added 2 commits December 17, 2020 11:11
I had to relax a couple of the rubocop constraints in order to fit these
changes in.

Also, there was another change in integration_spec.rb that appears
unrelated. After making the change in trackable.rb, the specs started
failing because, while the #history_tracks method was returning a new
array with an additional member, the #last method was continuing to
return the same record. Addressing the last member of the array by index
avoids the issue.
@coveralls
Copy link

coveralls commented Dec 17, 2020

Coverage Status

Coverage increased (+0.002%) to 99.421% when pulling ff2f26a on getaroom:avoid-corrupt-documents-2 into 4cbd18e on mongoid:master.

@dblock dblock merged commit a78a831 into mongoid:master Dec 17, 2020
@dblock
Copy link
Collaborator

dblock commented Dec 17, 2020

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants