Skip to content

Commit 483aa5a

Browse files
p-mongopjohnnyshields
authored
MONGOID-5193 rails 7 support
(#5122) * MONGOID-5193 rails 7 support * rails 7.0 gemfile * GH Actions support for Rails 7.0 * Update gemspec * add ruby 3 note * fix language Co-authored-by: Oleg Pudeyev <[email protected]> Co-authored-by: shields <[email protected]> Co-authored-by: Johnny Shields <[email protected]>
1 parent c0ed907 commit 483aa5a

File tree

5 files changed

+87
-7
lines changed

5 files changed

+87
-7
lines changed

.evergreen/config.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ axes:
515515
display_name: "Rails 6.1"
516516
variables:
517517
RAILS: "6.1"
518+
- id: "7.0"
519+
display_name: "Rails 7.0"
520+
variables:
521+
RAILS: "7.0"
518522
- id: "i18n"
519523
display_name: I18n version
520524
values:
@@ -648,6 +652,19 @@ buildvariants:
648652
tasks:
649653
- name: "test"
650654

655+
- matrix_name: "rails-7"
656+
matrix_spec:
657+
ruby: ["ruby-3.0"]
658+
driver: ["current"]
659+
mongodb-version: "5.0"
660+
topology: "standalone"
661+
rails: ['7.0']
662+
display_name: "${rails}, ${driver}, ${mongodb-version}"
663+
run_on:
664+
- rhel70-small
665+
tasks:
666+
- name: "test"
667+
651668
- matrix_name: "rails-6"
652669
matrix_spec:
653670
ruby: ["ruby-3.0"]

.github/workflows/test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,46 @@ jobs:
178178
i18n:
179179
gemfile: gemfiles/driver_min.gemfile
180180
experimental: false
181+
- mongodb: '5.0'
182+
ruby: ruby-3.1
183+
topology: server
184+
os: ubuntu-20.04
185+
task: test
186+
driver: current
187+
rails: '7.0'
188+
i18n:
189+
gemfile: gemfiles/rails-7.0.gemfile
190+
experimental: false
191+
- mongodb: '5.0'
192+
ruby: ruby-3.1
193+
topology: server
194+
os: ubuntu-20.04
195+
task: test
196+
driver: current
197+
rails: '6.1'
198+
i18n:
199+
gemfile: gemfiles/rails-6.1.gemfile
200+
experimental: false
201+
- mongodb: '5.0'
202+
ruby: ruby-3.0
203+
topology: server
204+
os: ubuntu-20.04
205+
task: test
206+
driver: current
207+
rails: '7.0'
208+
i18n:
209+
gemfile: gemfiles/rails-7.0.gemfile
210+
experimental: false
211+
- mongodb: '5.0'
212+
ruby: ruby-3.0
213+
topology: server
214+
os: ubuntu-20.04
215+
task: test
216+
driver: current
217+
rails: '6.1'
218+
i18n:
219+
gemfile: gemfiles/rails-6.1.gemfile
220+
experimental: false
181221
- mongodb: '5.0'
182222
ruby: ruby-3.0
183223
topology: server

docs/reference/compatibility.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ are supported by Mongoid.
265265
:class: compatibility-large no-padding
266266

267267
* - Mongoid
268+
- Rails 7.0
268269
- Rails 6.1
269270
- Rails 6.0
270271
- Rails 5.2
@@ -273,6 +274,7 @@ are supported by Mongoid.
273274
- Rails 4.2
274275

275276
* - 7.4
277+
- |checkmark|
276278
- |checkmark|
277279
- |checkmark|
278280
- |checkmark| [#rails-5-ruby-3.0]_
@@ -281,6 +283,7 @@ are supported by Mongoid.
281283
-
282284

283285
* - 7.3
286+
-
284287
- |checkmark|
285288
- |checkmark|
286289
- |checkmark| [#rails-5-ruby-3.0]_
@@ -289,6 +292,7 @@ are supported by Mongoid.
289292
-
290293

291294
* - 7.2
295+
-
292296
- |checkmark| [#rails-6.1]_
293297
- |checkmark|
294298
- |checkmark| [#rails-5-ruby-3.0]_
@@ -297,6 +301,7 @@ are supported by Mongoid.
297301
-
298302

299303
* - 7.1
304+
-
300305
- |checkmark| [#rails-6.1]_
301306
- |checkmark|
302307
- |checkmark|
@@ -305,6 +310,7 @@ are supported by Mongoid.
305310
-
306311

307312
* - 7.0
313+
-
308314
- |checkmark| [#rails-6.1]_
309315
- |checkmark| [#rails-6]_
310316
- |checkmark|
@@ -313,6 +319,7 @@ are supported by Mongoid.
313319
-
314320

315321
* - 6.4
322+
-
316323
-
317324
-
318325
- |checkmark|
@@ -321,6 +328,7 @@ are supported by Mongoid.
321328
-
322329

323330
* - 6.3
331+
-
324332
-
325333
-
326334
- |checkmark|
@@ -329,6 +337,7 @@ are supported by Mongoid.
329337
-
330338

331339
* - 6.2
340+
-
332341
-
333342
-
334343
- |checkmark|
@@ -341,6 +350,7 @@ are supported by Mongoid.
341350
-
342351
-
343352
-
353+
-
344354
- |checkmark|
345355
-
346356

@@ -349,6 +359,7 @@ are supported by Mongoid.
349359
-
350360
-
351361
-
362+
-
352363
- |checkmark|
353364
-
354365

@@ -358,6 +369,7 @@ are supported by Mongoid.
358369
-
359370
-
360371
-
372+
-
361373
- |checkmark|
362374

363375
* - 5.2
@@ -366,6 +378,7 @@ are supported by Mongoid.
366378
-
367379
-
368380
-
381+
-
369382
- |checkmark|
370383

371384
.. [#rails-5-ruby-3.0] Using Rails 5.x with Ruby 3 is not supported.

gemfiles/rails-7.0.gemfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'actionpack', '~> 7.0'
4+
gem 'activemodel', '~> 7.0'
5+
6+
gemspec path: '..'
7+
8+
require_relative './standard'
9+
10+
standard_dependencies

mongoid.gemspec

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ Gem::Specification.new do |s|
3333
s.required_ruby_version = ">= 2.5"
3434
s.required_rubygems_version = ">= 1.3.6"
3535

36-
if RUBY_VERSION.start_with?('2.')
37-
s.add_dependency("activemodel", [">=5.1", "<6.2"])
38-
elsif RUBY_VERSION.start_with?('3.')
39-
s.add_dependency("activemodel", [">=6.0", "<6.2"])
40-
end
36+
# Ruby 3.0 requires ActiveModel 6.0 or higher.
37+
# activemodel 7.0.0 cannot be used due to Class#descendants issue
38+
# See: https://github.com/rails/rails/pull/43951
39+
s.add_dependency("activemodel", ['>=5.1', '<7.1', '!= 7.0.0'])
4140
s.add_dependency("mongo", ['>=2.10.5', '<3.0.0'])
42-
# Using this gem is recommended for handling argument delegation issues,
41+
42+
# The ruby2_keywords gem is recommended for handling argument delegation issues,
4343
# especially if support for 2.6 or prior is required.
4444
# See https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/#delegation
4545
#
46-
# We have a bunch of complex delegation logic, including various method_missngs.
46+
# We have a bunch of complex delegation logic, including various method_missings.
4747
# If we try to fix them "right", it will add too much logic. We will have to
4848
# handle different Ruby versions (including minor ones, Ruby 2.6 and 2.7
4949
# behave differently), hash key types (strings vs symbols), ways of passing

0 commit comments

Comments
 (0)