Module: Mongoid::Clients::StorageOptions
- Extended by:
- ActiveSupport::Concern
- Included in:
- Mongoid::Clients
- Defined in:
- lib/mongoid/clients/storage_options.rb
Overview
Mixin module included into Mongoid::Document which adds the ability to set the collection in which to store the document by default.
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#remembered_storage_options ⇒ Hash | nil
private
Remembers the storage options that were active when the current object was instantiated/created.
Instance Method Summary collapse
-
#remember_storage_options! ⇒ Object
private
Saves the storage options from the current persistence context.
-
#storage_options ⇒ Hash
private
The storage options that apply to this record, consisting of both the class-level declared storage options (e.g. store_in) merged with any remembered storage options.
Instance Attribute Details
#remembered_storage_options ⇒ Hash | nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Remembers the storage options that were active when the current object was instantiated/created.
25 26 27 |
# File 'lib/mongoid/clients/storage_options.rb', line 25 def @remembered_storage_options end |
Instance Method Details
#remember_storage_options! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Saves the storage options from the current persistence context.
41 42 43 44 45 46 |
# File 'lib/mongoid/clients/storage_options.rb', line 41 def return if Mongoid.legacy_persistence_context_behavior opts = persistence_context. self. = opts if opts end |
#storage_options ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The storage options that apply to this record, consisting of both the class-level declared storage options (e.g. store_in) merged with any remembered storage options.
34 35 36 |
# File 'lib/mongoid/clients/storage_options.rb', line 34 def self.class..merge( || {}) end |