module Mongoid::Clients::StorageOptions
Mixin module included into Mongoid::Document
which adds the ability to set the collection in which to store the document by default.
Attributes
remembered_storage_options[RW]
Remembers the storage options that were active when the current object was instantiated/created.
@return [ Hash | nil ] the storage options that have been cached for
this object instance (or nil if no storage options have been cached).
@api private
Public Instance Methods
remember_storage_options!()
click to toggle source
Saves the storage options from the current persistence context.
@api private
# File lib/mongoid/clients/storage_options.rb, line 41 def remember_storage_options! return if Mongoid.legacy_persistence_context_behavior opts = persistence_context.requested_storage_options self.remembered_storage_options = opts if opts end
storage_options()
click to toggle source
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.
@return [ Hash ] the storage options for the record
@api private
# File lib/mongoid/clients/storage_options.rb, line 34 def storage_options self.class.storage_options.merge(remembered_storage_options || {}) end