-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Bring back Mongoid official support #5568
Draft
carlosantoniodasilva
wants to merge
3
commits into
main
Choose a base branch
from
ca-mongoid
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
carlosantoniodasilva
force-pushed
the
ca-mongoid
branch
from
March 17, 2023 14:00
45d87b8
to
453ab41
Compare
carlosantoniodasilva
force-pushed
the
ca-mongoid
branch
2 times, most recently
from
March 31, 2023 14:49
f0fad81
to
09b6b46
Compare
carlosantoniodasilva
force-pushed
the
ca-mongoid
branch
from
October 13, 2023 14:54
09b6b46
to
d9eb3a5
Compare
carlosantoniodasilva
force-pushed
the
ca-mongoid
branch
from
April 9, 2024 20:03
d9eb3a5
to
bb2725c
Compare
Devise hasn't been tested with Mongoid since Rails version 5, only 4.x was still running those tests. This enables the tests again on all currently supported Rails versions, with their respective mongoid supported versions. There were a couple of minor tweaks to make it happen, namely: * The way we were dropping the session before doesn't work in later versions so I changed back to calling `purge!` which appears to work fine. We used to call `Mongoid.purge!` but that changed in #4686. * Some of the configs in the Rails test app were setting Active Record values when outside of the AR ORM tests, updated those to make sure they are not set when running mongoid ORM tests. * The validations added to the shared admin code in tests were only checking for Rails version 5.1, but we need to use the same check for AR 5.1 that is used in code, otherwise it will try to use methods not available in mongoid there. I also had to lock the sqlite3 gem on Rails 6 versions to 1.5.x, due to it dropping support to Ruby 2.6 on v1.6+ now, and those Rails 6 versions need to support that Ruby version. Finally, I locked mongoid to v7.5+ but not allowing v8+ yet, there seems to be some change to dirty attributes that I need to look into which is making a handful of tests fail. For now, this should hopefully get us to green as step 1.
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
carlosantoniodasilva
force-pushed
the
ca-mongoid
branch
from
April 10, 2024 12:49
bb2725c
to
a2f1d29
Compare
Now that Mongoid has released new versions of 8.1 which contain the changes we rely on for dirty tracking, we can just point our Gemfile to their released versions for testing against them. Also update Rails and related dependencies to latest in the process, to make sure they all match together. (Mongoid v8.1.2 didn't allow Rails 7.1 for instance, only v8.1.3+)
carlosantoniodasilva
force-pushed
the
ca-mongoid
branch
from
April 10, 2024 16:26
d37ded5
to
d18d6d8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Devise hasn't been tested with Mongoid since Rails version 5, only 4.x was still running those tests.
This enables the tests again on all currently supported Rails versions, with their respective mongoid supported versions. There were a couple of minor tweaks to make it happen, namely:
purge!
which appears to work fine. We used to callMongoid.purge!
but that changed in Fix mongoid test failed problem #4686.I also had to lock the sqlite3 gem on Rails 6 versions to 1.5.x, due to it dropping support to Ruby 2.6 on v1.6+ now, and those Rails 6 versions need to support that Ruby version.
Finally, I locked mongoid to v7.5+ but not allowing v8+ yet, there seems to be some change to dirty attributes that I need to look into which is making a handful of tests fail. For now, this should hopefully get us to green as step 1.I got Mongoid v8.0 working with a couple of tweaks to dirty tracking, hopefully that's all that's needed.