File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -412,10 +412,25 @@ module DeprecatedOptions
412
412
object_id_as_json_oid
413
413
overwrite_chained_operators ]
414
414
415
- OPTIONS . each do |option |
416
- define_method ( :"#{ option } =" ) do |value |
417
- Mongoid ::Warnings . send ( :"warn_#{ option } _deprecated" )
418
- super ( value )
415
+ if RUBY_VERSION < '3.0'
416
+ def self . prepended ( klass )
417
+ klass . class_eval do
418
+ OPTIONS . each do |option |
419
+ alias_method :"#{ option } _without_deprecation=" , :"#{ option } ="
420
+
421
+ define_method ( :"#{ option } =" ) do |value |
422
+ Mongoid ::Warnings . send ( :"warn_#{ option } _deprecated" )
423
+ send ( :"#{ option } _without_deprecation=" , value )
424
+ end
425
+ end
426
+ end
427
+ end
428
+ else
429
+ OPTIONS . each do |option |
430
+ define_method ( :"#{ option } =" ) do |value |
431
+ Mongoid ::Warnings . send ( :"warn_#{ option } _deprecated" )
432
+ super ( value )
433
+ end
419
434
end
420
435
end
421
436
end
You can’t perform that action at this time.
0 commit comments