Module: Mongoid::Config::Defaults
- Included in:
- Mongoid::Config
- Defined in:
- lib/mongoid/config/defaults.rb
Overview
Encapsulates logic for loading defaults.
Instance Method Summary collapse
-
#load_defaults(version) ⇒ Object
Load the defaults for the feature flags in the given Mongoid version.
Instance Method Details
#load_defaults(version) ⇒ Object
Load the defaults for the feature flags in the given Mongoid version. Note that this method will load the new functionality introduced in the given Mongoid version.
raises [ ArgumentError ] if an invalid version is given.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/mongoid/config/defaults.rb', line 14 def load_defaults(version) case version.to_s when /^[0-7]\./ raise ArgumentError, "Version no longer supported: #{version}" when '8.0' self.legacy_readonly = true load_defaults '8.1' when '8.1' self.immutable_ids = false self.legacy_persistence_context_behavior = true self. = true self. = false load_defaults '9.0' when '9.0' self.allow_reparenting_via_nested_attributes = true self.autosave_saves_unchanged_documents = true load_defaults '9.1' when '9.1' # All flag defaults currently reflect 9.1 behavior. else raise ArgumentError, "Unknown version: #{version}" end end |