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

Add support for Mongoid 7.0 and 7.1 #56

Merged
merged 5 commits into from
Sep 7, 2020
Merged

Conversation

joe1chen
Copy link
Contributor

This pull adds support for Mongoid 7.0 and 7.1. Mongoid 7+ had some major changes to the internal classes for relations (now called associations).

Summary of changes:

  • Updated references to internal classes for associations.
  • Mongoid 7 is a little stricter when it comes to defining associations, so specs had to be updated to add inverse_of in order to avoid Mongoid 7 runtime errors.
  • spec_helper.rb had a bug where the association fields nearest_id, nearest_type, etc. were being incorrectly removed, causing a runtime error when running specs in Mongoid 7. The field reset code had to be updated to properly restore fields between runs, and references to fields were also updated accordingly.
  • Defining a has_many association with inverse_of: nil behaves differently under Mongoid 7. Prior to Mongoid 7, this association has a nil inverse value, but under Mongoid 7, the association is assigned to a default inverse value. The spec in macros_spec.rb has been updated to pass under Mongoid 7 and to note this difference.

@joe1chen
Copy link
Contributor Author

By the way this should fix issue #55

@joe1chen
Copy link
Contributor Author

One more thing to note, I changed the Travis matrix to add Ruby 2.6 and remove Ruby 2.3 since Rails 6 supports only Ruby 2.5+

@joshed-io
Copy link
Owner

Thanks @joe1chen! Really appreciate the contribution here.

@joshed-io joshed-io merged commit 706ba4a into joshed-io:master Sep 7, 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.

None yet

2 participants