diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 70e4ae92e6..a505b0755f 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -589,6 +589,10 @@ axes: display_name: "Rails 7.0" variables: RAILS: "7.0" + - id: "7.1" + display_name: "Rails 7.1" + variables: + RAILS: "7.1" - id: "i18n" display_name: I18n version @@ -744,7 +748,7 @@ buildvariants: driver: ["current"] mongodb-version: "6.0" topology: "standalone" - rails: ['7.0'] + rails: ['7.0', '7.1'] os: ubuntu-22.04 fle: helper display_name: "${rails}, ${driver}, ${mongodb-version} (FLE ${fle})" @@ -830,7 +834,7 @@ buildvariants: mongodb-version: '6.0' topology: standalone app-tests: yes - rails: ['6.0', '6.1', '7.0'] + rails: ['6.0', '6.1', '7.0', '7.1'] os: rhel80 display_name: "app tests ${driver}, ${ruby}, ${rails}" tasks: diff --git a/.evergreen/config/axes.yml.erb b/.evergreen/config/axes.yml.erb index 2c1e5a44c3..e7a5a2aba1 100644 --- a/.evergreen/config/axes.yml.erb +++ b/.evergreen/config/axes.yml.erb @@ -214,6 +214,10 @@ axes: display_name: "Rails 7.0" variables: RAILS: "7.0" + - id: "7.1" + display_name: "Rails 7.1" + variables: + RAILS: "7.1" - id: "i18n" display_name: I18n version diff --git a/.evergreen/config/variants.yml.erb b/.evergreen/config/variants.yml.erb index 9348e6b05b..78cfa7a66e 100644 --- a/.evergreen/config/variants.yml.erb +++ b/.evergreen/config/variants.yml.erb @@ -115,7 +115,7 @@ buildvariants: driver: ["current"] mongodb-version: "6.0" topology: "standalone" - rails: ['7.0'] + rails: ['7.0', '7.1'] os: ubuntu-22.04 fle: helper display_name: "${rails}, ${driver}, ${mongodb-version} (FLE ${fle})" @@ -201,7 +201,7 @@ buildvariants: mongodb-version: '6.0' topology: standalone app-tests: yes - rails: ['6.0', '6.1', '7.0'] + rails: ['6.0', '6.1', '7.0', '7.1'] os: rhel80 display_name: "app tests ${driver}, ${ruby}, ${rails}" tasks: diff --git a/docs/reference/compatibility.txt b/docs/reference/compatibility.txt index 85b4bbf4b2..4c7751a67a 100644 --- a/docs/reference/compatibility.txt +++ b/docs/reference/compatibility.txt @@ -399,6 +399,7 @@ are supported by Mongoid. :class: compatibility-large no-padding * - Mongoid + - Rails 7.1 - Rails 7.0 - Rails 6.1 - Rails 6.0 @@ -406,6 +407,7 @@ are supported by Mongoid. - Rails 5.1 * - 8.1 + - |checkmark| [#rails-7.1]_ - |checkmark| - |checkmark| - |checkmark| @@ -413,6 +415,7 @@ are supported by Mongoid. - * - 8.0 + - |checkmark| [#rails-7.1]_ - |checkmark| - |checkmark| - |checkmark| @@ -420,6 +423,7 @@ are supported by Mongoid. - * - 7.5 + - - |checkmark| - |checkmark| - |checkmark| @@ -427,6 +431,7 @@ are supported by Mongoid. - D * - 7.4 + - - |checkmark| - |checkmark| - |checkmark| @@ -434,6 +439,7 @@ are supported by Mongoid. - |checkmark| [#rails-5-ruby-3.0]_ * - 7.3 + - - |checkmark| [#rails-7-Mongoid-7.3]_ - |checkmark| - |checkmark| @@ -441,6 +447,7 @@ are supported by Mongoid. - |checkmark| [#rails-5-ruby-3.0]_ * - 7.2 + - - - |checkmark| [#rails-6.1]_ - |checkmark| @@ -448,6 +455,7 @@ are supported by Mongoid. - |checkmark| [#rails-5-ruby-3.0]_ * - 7.1 + - - - |checkmark| [#rails-6.1]_ - |checkmark| @@ -455,6 +463,7 @@ are supported by Mongoid. - |checkmark| * - 7.0 + - - - |checkmark| [#rails-6.1]_ - |checkmark| [#rails-6]_ @@ -465,6 +474,7 @@ are supported by Mongoid. - - - + - - |checkmark| - |checkmark| @@ -477,4 +487,7 @@ are supported by Mongoid. .. [#rails-7-Mongoid-7.3] Rails 7.x requires Mongoid 7.3.4 or later. +.. [#rails-7.1] Rails 7.1 requires Mongoid 8.0.7 or 8.1.3 in the respective + 8.0 and 8.1 stable branches. + .. include:: /includes/unicode-checkmark.rst diff --git a/lib/mongoid/deprecable.rb b/lib/mongoid/deprecable.rb index 327bd72b70..36ae936d0e 100644 --- a/lib/mongoid/deprecable.rb +++ b/lib/mongoid/deprecable.rb @@ -28,7 +28,8 @@ module Deprecable # @param [ [ Symbol | Hash ]... ] *method_descriptors # The methods to deprecate, with optional replacement instructions. def deprecate(target_module, *method_descriptors) - Mongoid::Deprecation.deprecate_methods(target_module, *method_descriptors) + @_deprecator ||= Mongoid::Deprecation.new + @_deprecator.deprecate_methods(target_module, *method_descriptors) end end end diff --git a/lib/mongoid/deprecation.rb b/lib/mongoid/deprecation.rb index 4fb299418f..faab29a256 100644 --- a/lib/mongoid/deprecation.rb +++ b/lib/mongoid/deprecation.rb @@ -19,10 +19,10 @@ def initialize # # @return [ Array ] The deprecation behavior. def behavior - @behavior ||= Array(->(message, callstack, _deprecation_horizon, _gem_name) { + @behavior ||= Array(->(*args) { logger = Mongoid.logger - logger.warn(message) - logger.debug(callstack.join("\n ")) if debug + logger.warn(args[0]) + logger.debug(args[1].join("\n ")) if debug }) end end diff --git a/lib/mongoid/interceptable.rb b/lib/mongoid/interceptable.rb index 155236eae7..e2148637ae 100644 --- a/lib/mongoid/interceptable.rb +++ b/lib/mongoid/interceptable.rb @@ -314,7 +314,13 @@ def run_targeted_callbacks(place, kind) end self.class.send :define_method, name do env = ActiveSupport::Callbacks::Filters::Environment.new(self, false, nil) - sequence = chain.compile + sequence = if chain.method(:compile).arity == 0 + # ActiveSupport < 7.1 + chain.compile + else + # ActiveSupport >= 7.1 + chain.compile(nil) + end sequence.invoke_before(env) env.value = !env.halted sequence.invoke_after(env) diff --git a/mongoid.gemspec b/mongoid.gemspec index 4444859fb2..0a12d74ecb 100644 --- a/mongoid.gemspec +++ b/mongoid.gemspec @@ -38,7 +38,7 @@ Gem::Specification.new do |s| # 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("activemodel", ['>=5.1', '<7.2', '!= 7.0.0']) s.add_dependency("mongo", ['>=2.18.0', '<3.0.0']) s.add_dependency("concurrent-ruby", ['>= 1.0.5', '< 2.0'])