Skip to content

Commit

Permalink
Merge branch 'master' into 5658-fix-callbacks-for-embedded
Browse files Browse the repository at this point in the history
  • Loading branch information
comandeo-mongo committed Oct 11, 2023
2 parents 53e65e8 + 355ecd7 commit 39ef6bc
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 10 deletions.
8 changes: 6 additions & 2 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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})"
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .evergreen/config/axes.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .evergreen/config/variants.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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})"
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions docs/reference/compatibility.txt
Original file line number Diff line number Diff line change
Expand Up @@ -399,62 +399,71 @@ are supported by Mongoid.
:class: compatibility-large no-padding

* - Mongoid
- Rails 7.1
- Rails 7.0
- Rails 6.1
- Rails 6.0
- Rails 5.2
- Rails 5.1

* - 8.1
- |checkmark| [#rails-7.1]_
- |checkmark|
- |checkmark|
- |checkmark|
- |checkmark| [#rails-5-ruby-3.0]_
-

* - 8.0
- |checkmark| [#rails-7.1]_
- |checkmark|
- |checkmark|
- |checkmark|
- |checkmark| [#rails-5-ruby-3.0]_
-

* - 7.5
-
- |checkmark|
- |checkmark|
- |checkmark|
- |checkmark| [#rails-5-ruby-3.0]_
- D

* - 7.4
-
- |checkmark|
- |checkmark|
- |checkmark|
- |checkmark| [#rails-5-ruby-3.0]_
- |checkmark| [#rails-5-ruby-3.0]_

* - 7.3
-
- |checkmark| [#rails-7-Mongoid-7.3]_
- |checkmark|
- |checkmark|
- |checkmark| [#rails-5-ruby-3.0]_
- |checkmark| [#rails-5-ruby-3.0]_

* - 7.2
-
-
- |checkmark| [#rails-6.1]_
- |checkmark|
- |checkmark| [#rails-5-ruby-3.0]_
- |checkmark| [#rails-5-ruby-3.0]_

* - 7.1
-
-
- |checkmark| [#rails-6.1]_
- |checkmark|
- |checkmark|
- |checkmark|

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

Expand All @@ -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
3 changes: 2 additions & 1 deletion lib/mongoid/deprecable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module Deprecable
# @param [ [ Symbol | Hash<Symbol, [ Symbol | String ]> ]... ] *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
Expand Down
6 changes: 3 additions & 3 deletions lib/mongoid/deprecation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def initialize
#
# @return [ Array<Proc> ] 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
Expand Down
8 changes: 7 additions & 1 deletion lib/mongoid/interceptable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,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)
Expand Down
2 changes: 1 addition & 1 deletion mongoid.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'])

Expand Down

0 comments on commit 39ef6bc

Please sign in to comment.