-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
MONGOID-5104 Add AR-style dirty attributes #5092
Conversation
c770c50
to
4c2908f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually don't understand the changes here, can you please add a one sentence summary to the description and the resulting merge commit message should anyone happen to be debugging something in the future and be looking at this commit as a possible cause?
1c88ba0
to
84dcbc3
Compare
@p-mongo @comandeo please see this follow-up ticket: https://jira.mongodb.org/browse/MONGOID-5217 |
It appears Mongoid 8.0+ slightly [changed dirty tracking] behavior to more closely match Active Model/Record, however they haven't yet introduced the [new methods] that match the latest API, that seems to be coming on Mongoid 8.1 only. The changes here try to accommodate for that by determining which "attribute_changed?" method to call depending on whether the "*_previously_*" version exists. Newer versions of AR (5.1+) will continue to use the new API / methods, whereas previous versions and Mongoid 8.0+ will use these tweaked versions. No behavior should change for AR, but it will hopefully support Mongoid 8.0+ now. [changed dirty tracking] mongodb/mongoid#5092 [new methods] mongodb/mongoid#5440
It appears Mongoid 8.0+ slightly [changed dirty tracking] behavior to more closely match Active Model/Record, however they haven't yet introduced the [new methods] that match the latest API, that seems to be coming on Mongoid 8.1 only. The changes here try to accommodate for that by determining which "attribute_changed?" method to call depending on whether the "*_previously_*" version exists. Newer versions of AR (5.1+) will continue to use the new API / methods, whereas previous versions and Mongoid 8.0+ will use these tweaked versions. No behavior should change for AR, but it will hopefully support Mongoid 8.0+ now. [changed dirty tracking] mongodb/mongoid#5092 [new methods] mongodb/mongoid#5440
It appears Mongoid 8.0+ slightly [changed dirty tracking] behavior to more closely match Active Model/Record, however they haven't yet introduced the [new methods] that match the latest API, that seems to be coming on Mongoid 8.1 only. The changes here try to accommodate for that by determining which "attribute_changed?" method to call depending on whether the "*_previously_*" version exists. Newer versions of AR (5.1+) will continue to use the new API / methods, whereas previous versions and Mongoid 8.0+ will use these tweaked versions. No behavior should change for AR, but it will hopefully support Mongoid 8.0+ now. [changed dirty tracking] mongodb/mongoid#5092 [new methods] mongodb/mongoid#5440
It appears Mongoid 8.0+ slightly [changed dirty tracking] behavior to more closely match Active Model/Record, however they haven't yet introduced the [new methods] that match the latest API, that seems to be coming on Mongoid 8.1 only. The changes here try to accommodate for that by determining which "attribute_changed?" method to call depending on whether the "*_previously_*" version exists. Newer versions of AR (5.1+) will continue to use the new API / methods, whereas previous versions and Mongoid 8.0+ will use these tweaked versions. No behavior should change for AR, but it will hopefully support Mongoid 8.0+ now. [changed dirty tracking] mongodb/mongoid#5092 [new methods] mongodb/mongoid#5440
Dirty data are now cleared and
changes
movedprevious_changes
immediately after a document is persisted in MongoDB. It means that old attribute values are available inbefore_
callbacks, and updated attribute values are available inafter_
callbacks.