Module: Mongoid::Config::DeprecatedOptions

Included in:
Mongoid::Config
Defined in:
lib/mongoid/config.rb

Constant Summary collapse

OPTIONS =
%i[ use_activesupport_time_zone
broken_aggregables
broken_alias_handling
broken_and
broken_scoping
broken_updates
compare_time_by_ms
legacy_attributes
legacy_pluck_distinct
legacy_triple_equals
object_id_as_json_oid
overwrite_chained_operators ]

Class Method Summary collapse

Class Method Details

.prepended(klass) ⇒ Object



456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/mongoid/config.rb', line 456

def self.prepended(klass)
  klass.class_eval do
    OPTIONS.each do |option|
      alias_method :"#{option}_without_deprecation=", :"#{option}="

      define_method(:"#{option}=") do |value|
        Mongoid::Warnings.send(:"warn_#{option}_deprecated")
        send(:"#{option}_without_deprecation=", value)
      end
    end
  end
end