Skip to content

Commit 355ecd7

Browse files
MONGOID-5689 Add Rails 7.1 support (#5728)
* MONGOID-5689 Add Rails 7.1 support * Fix 7.1 incompatibilities * Update docs
1 parent 8c79f57 commit 355ecd7

File tree

8 files changed

+38
-10
lines changed

8 files changed

+38
-10
lines changed

.evergreen/config.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,10 @@ axes:
589589
display_name: "Rails 7.0"
590590
variables:
591591
RAILS: "7.0"
592+
- id: "7.1"
593+
display_name: "Rails 7.1"
594+
variables:
595+
RAILS: "7.1"
592596

593597
- id: "i18n"
594598
display_name: I18n version
@@ -744,7 +748,7 @@ buildvariants:
744748
driver: ["current"]
745749
mongodb-version: "6.0"
746750
topology: "standalone"
747-
rails: ['7.0']
751+
rails: ['7.0', '7.1']
748752
os: ubuntu-22.04
749753
fle: helper
750754
display_name: "${rails}, ${driver}, ${mongodb-version} (FLE ${fle})"
@@ -830,7 +834,7 @@ buildvariants:
830834
mongodb-version: '6.0'
831835
topology: standalone
832836
app-tests: yes
833-
rails: ['6.0', '6.1', '7.0']
837+
rails: ['6.0', '6.1', '7.0', '7.1']
834838
os: rhel80
835839
display_name: "app tests ${driver}, ${ruby}, ${rails}"
836840
tasks:

.evergreen/config/axes.yml.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ axes:
214214
display_name: "Rails 7.0"
215215
variables:
216216
RAILS: "7.0"
217+
- id: "7.1"
218+
display_name: "Rails 7.1"
219+
variables:
220+
RAILS: "7.1"
217221

218222
- id: "i18n"
219223
display_name: I18n version

.evergreen/config/variants.yml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ buildvariants:
115115
driver: ["current"]
116116
mongodb-version: "6.0"
117117
topology: "standalone"
118-
rails: ['7.0']
118+
rails: ['7.0', '7.1']
119119
os: ubuntu-22.04
120120
fle: helper
121121
display_name: "${rails}, ${driver}, ${mongodb-version} (FLE ${fle})"
@@ -201,7 +201,7 @@ buildvariants:
201201
mongodb-version: '6.0'
202202
topology: standalone
203203
app-tests: yes
204-
rails: ['6.0', '6.1', '7.0']
204+
rails: ['6.0', '6.1', '7.0', '7.1']
205205
os: rhel80
206206
display_name: "app tests ${driver}, ${ruby}, ${rails}"
207207
tasks:

docs/reference/compatibility.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,62 +399,71 @@ are supported by Mongoid.
399399
:class: compatibility-large no-padding
400400

401401
* - Mongoid
402+
- Rails 7.1
402403
- Rails 7.0
403404
- Rails 6.1
404405
- Rails 6.0
405406
- Rails 5.2
406407
- Rails 5.1
407408

408409
* - 8.1
410+
- |checkmark| [#rails-7.1]_
409411
- |checkmark|
410412
- |checkmark|
411413
- |checkmark|
412414
- |checkmark| [#rails-5-ruby-3.0]_
413415
-
414416

415417
* - 8.0
418+
- |checkmark| [#rails-7.1]_
416419
- |checkmark|
417420
- |checkmark|
418421
- |checkmark|
419422
- |checkmark| [#rails-5-ruby-3.0]_
420423
-
421424

422425
* - 7.5
426+
-
423427
- |checkmark|
424428
- |checkmark|
425429
- |checkmark|
426430
- |checkmark| [#rails-5-ruby-3.0]_
427431
- D
428432

429433
* - 7.4
434+
-
430435
- |checkmark|
431436
- |checkmark|
432437
- |checkmark|
433438
- |checkmark| [#rails-5-ruby-3.0]_
434439
- |checkmark| [#rails-5-ruby-3.0]_
435440

436441
* - 7.3
442+
-
437443
- |checkmark| [#rails-7-Mongoid-7.3]_
438444
- |checkmark|
439445
- |checkmark|
440446
- |checkmark| [#rails-5-ruby-3.0]_
441447
- |checkmark| [#rails-5-ruby-3.0]_
442448

443449
* - 7.2
450+
-
444451
-
445452
- |checkmark| [#rails-6.1]_
446453
- |checkmark|
447454
- |checkmark| [#rails-5-ruby-3.0]_
448455
- |checkmark| [#rails-5-ruby-3.0]_
449456

450457
* - 7.1
458+
-
451459
-
452460
- |checkmark| [#rails-6.1]_
453461
- |checkmark|
454462
- |checkmark|
455463
- |checkmark|
456464

457465
* - 7.0
466+
-
458467
-
459468
- |checkmark| [#rails-6.1]_
460469
- |checkmark| [#rails-6]_
@@ -465,6 +474,7 @@ are supported by Mongoid.
465474
-
466475
-
467476
-
477+
-
468478
- |checkmark|
469479
- |checkmark|
470480

@@ -477,4 +487,7 @@ are supported by Mongoid.
477487

478488
.. [#rails-7-Mongoid-7.3] Rails 7.x requires Mongoid 7.3.4 or later.
479489

490+
.. [#rails-7.1] Rails 7.1 requires Mongoid 8.0.7 or 8.1.3 in the respective
491+
8.0 and 8.1 stable branches.
492+
480493
.. include:: /includes/unicode-checkmark.rst

lib/mongoid/deprecable.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ module Deprecable
2828
# @param [ [ Symbol | Hash<Symbol, [ Symbol | String ]> ]... ] *method_descriptors
2929
# The methods to deprecate, with optional replacement instructions.
3030
def deprecate(target_module, *method_descriptors)
31-
Mongoid::Deprecation.deprecate_methods(target_module, *method_descriptors)
31+
@_deprecator ||= Mongoid::Deprecation.new
32+
@_deprecator.deprecate_methods(target_module, *method_descriptors)
3233
end
3334
end
3435
end

lib/mongoid/deprecation.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ def initialize
1919
#
2020
# @return [ Array<Proc> ] The deprecation behavior.
2121
def behavior
22-
@behavior ||= Array(->(message, callstack, _deprecation_horizon, _gem_name) {
22+
@behavior ||= Array(->(*args) {
2323
logger = Mongoid.logger
24-
logger.warn(message)
25-
logger.debug(callstack.join("\n ")) if debug
24+
logger.warn(args[0])
25+
logger.debug(args[1].join("\n ")) if debug
2626
})
2727
end
2828
end

lib/mongoid/interceptable.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,13 @@ def run_targeted_callbacks(place, kind)
314314
end
315315
self.class.send :define_method, name do
316316
env = ActiveSupport::Callbacks::Filters::Environment.new(self, false, nil)
317-
sequence = chain.compile
317+
sequence = if chain.method(:compile).arity == 0
318+
# ActiveSupport < 7.1
319+
chain.compile
320+
else
321+
# ActiveSupport >= 7.1
322+
chain.compile(nil)
323+
end
318324
sequence.invoke_before(env)
319325
env.value = !env.halted
320326
sequence.invoke_after(env)

mongoid.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
3838
# Ruby 3.0 requires ActiveModel 6.0 or higher.
3939
# activemodel 7.0.0 cannot be used due to Class#descendants issue
4040
# See: https://github.com/rails/rails/pull/43951
41-
s.add_dependency("activemodel", ['>=5.1', '<7.1', '!= 7.0.0'])
41+
s.add_dependency("activemodel", ['>=5.1', '<7.2', '!= 7.0.0'])
4242
s.add_dependency("mongo", ['>=2.18.0', '<3.0.0'])
4343
s.add_dependency("concurrent-ruby", ['>= 1.0.5', '< 2.0'])
4444

0 commit comments

Comments
 (0)