Skip to content

MONGOID-5193 rails 7 support #5122

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

Merged
merged 6 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,10 @@ axes:
display_name: "Rails 6.1"
variables:
RAILS: "6.1"
- id: "7.0"
display_name: "Rails 7.0"
variables:
RAILS: "7.0"
- id: "i18n"
display_name: I18n version
values:
Expand Down Expand Up @@ -648,6 +652,19 @@ buildvariants:
tasks:
- name: "test"

- matrix_name: "rails-7"
matrix_spec:
ruby: ["ruby-3.0"]
driver: ["current"]
mongodb-version: "5.0"
topology: "standalone"
rails: ['7.0']
display_name: "${rails}, ${driver}, ${mongodb-version}"
run_on:
- rhel70-small
tasks:
- name: "test"

- matrix_name: "rails-6"
matrix_spec:
ruby: ["ruby-3.0"]
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,46 @@ jobs:
i18n:
gemfile: gemfiles/driver_min.gemfile
experimental: false
- mongodb: '5.0'
ruby: ruby-3.1
topology: server
os: ubuntu-20.04
task: test
driver: current
rails: '7.0'
i18n:
gemfile: gemfiles/rails-7.0.gemfile
experimental: false
- mongodb: '5.0'
ruby: ruby-3.1
topology: server
os: ubuntu-20.04
task: test
driver: current
rails: '6.1'
i18n:
gemfile: gemfiles/rails-6.1.gemfile
experimental: false
- mongodb: '5.0'
ruby: ruby-3.0
topology: server
os: ubuntu-20.04
task: test
driver: current
rails: '7.0'
i18n:
gemfile: gemfiles/rails-7.0.gemfile
experimental: false
- mongodb: '5.0'
ruby: ruby-3.0
topology: server
os: ubuntu-20.04
task: test
driver: current
rails: '6.1'
i18n:
gemfile: gemfiles/rails-6.1.gemfile
experimental: false
- mongodb: '5.0'
ruby: ruby-3.0
topology: server
Expand Down
13 changes: 13 additions & 0 deletions docs/reference/compatibility.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ are supported by Mongoid.
:class: compatibility-large no-padding

* - Mongoid
- Rails 7.0
- Rails 6.1
- Rails 6.0
- Rails 5.2
Expand All @@ -273,6 +274,7 @@ are supported by Mongoid.
- Rails 4.2

* - 7.4
- |checkmark|
- |checkmark|
- |checkmark|
- |checkmark| [#rails-5-ruby-3.0]_
Expand All @@ -281,6 +283,7 @@ are supported by Mongoid.
-

* - 7.3
-
- |checkmark|
- |checkmark|
- |checkmark| [#rails-5-ruby-3.0]_
Expand All @@ -289,6 +292,7 @@ are supported by Mongoid.
-

* - 7.2
-
- |checkmark| [#rails-6.1]_
- |checkmark|
- |checkmark| [#rails-5-ruby-3.0]_
Expand All @@ -297,6 +301,7 @@ are supported by Mongoid.
-

* - 7.1
-
- |checkmark| [#rails-6.1]_
- |checkmark|
- |checkmark|
Expand All @@ -305,6 +310,7 @@ are supported by Mongoid.
-

* - 7.0
-
- |checkmark| [#rails-6.1]_
- |checkmark| [#rails-6]_
- |checkmark|
Expand All @@ -313,6 +319,7 @@ are supported by Mongoid.
-

* - 6.4
-
-
-
- |checkmark|
Expand All @@ -321,6 +328,7 @@ are supported by Mongoid.
-

* - 6.3
-
-
-
- |checkmark|
Expand All @@ -329,6 +337,7 @@ are supported by Mongoid.
-

* - 6.2
-
-
-
- |checkmark|
Expand All @@ -341,6 +350,7 @@ are supported by Mongoid.
-
-
-
-
- |checkmark|
-

Expand All @@ -349,6 +359,7 @@ are supported by Mongoid.
-
-
-
-
- |checkmark|
-

Expand All @@ -358,6 +369,7 @@ are supported by Mongoid.
-
-
-
-
- |checkmark|

* - 5.2
Expand All @@ -366,6 +378,7 @@ are supported by Mongoid.
-
-
-
-
- |checkmark|

.. [#rails-5-ruby-3.0] Using Rails 5.x with Ruby 3 is not supported.
Expand Down
10 changes: 10 additions & 0 deletions gemfiles/rails-7.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source 'https://rubygems.org'

gem 'actionpack', '~> 7.0'
gem 'activemodel', '~> 7.0'

gemspec path: '..'

require_relative './standard'

standard_dependencies
14 changes: 7 additions & 7 deletions mongoid.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ Gem::Specification.new do |s|
s.required_ruby_version = ">= 2.5"
s.required_rubygems_version = ">= 1.3.6"

if RUBY_VERSION.start_with?('2.')
s.add_dependency("activemodel", [">=5.1", "<6.2"])
elsif RUBY_VERSION.start_with?('3.')
s.add_dependency("activemodel", [">=6.0", "<6.2"])
end
# Ruby 3.0 requires ActiveModel 6.0 or higher.
# activemodel 7.0.0 cannot be used due to Class#descendants issue
# See: https://github.com/rails/rails/pull/43951
s.add_dependency("activemodel", ['>=5.1', '<7.1', '!= 7.0.0'])
s.add_dependency("mongo", ['>=2.10.5', '<3.0.0'])
# Using this gem is recommended for handling argument delegation issues,

# The ruby2_keywords gem is recommended for handling argument delegation issues,
# especially if support for 2.6 or prior is required.
# See https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/#delegation
#
# We have a bunch of complex delegation logic, including various method_missngs.
# We have a bunch of complex delegation logic, including various method_missings.
# If we try to fix them "right", it will add too much logic. We will have to
# handle different Ruby versions (including minor ones, Ruby 2.6 and 2.7
# behave differently), hash key types (strings vs symbols), ways of passing
Expand Down