Sha256: 3bce0a772ce7a574f4be708d39878733e83006ff69ecb8f3734eeb114d7be393

Contents?: true

Size: 630 Bytes

Versions: 13

Compression:

Stored size: 630 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:

  # Contains behaviour for determining if Mongoid is in safe mode.
  module Safe

    # Determine based on configuration if we are persisting in safe mode or
    # not.
    #
    # The query option will always override the global configuration.
    #
    # @example Are we in safe mode?
    #   document.safe_mode?(:safe => true)
    #
    # @param [ Hash ] options Persistence options.
    #
    # @return [ true, false ] True if in safe mode, false if not.
    def safe_mode?(options)
      safe = options[:safe]
      safe.nil? ? Mongoid.persist_in_safe_mode : safe
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
mongoid-braxton-2.0.2 lib/mongoid/safe.rb
mongoid-2.0.2 lib/mongoid/safe.rb
mongoid-2.0.1 lib/mongoid/safe.rb
mongoid-2.0.0 lib/mongoid/safe.rb
mongoid-2.0.0.rc.8 lib/mongoid/safe.rb
mongoid-2.0.0.rc.7 lib/mongoid/safe.rb
stonegao-mongoid-2.0.0.rc.6 lib/mongoid/safe.rb
mongoid-2.0.0.rc.6 lib/mongoid/safe.rb
mongoid-2.0.0.rc.5 lib/mongoid/safe.rb
mongoid-2.0.0.rc.4 lib/mongoid/safe.rb
mongoid-2.0.0.rc.3 lib/mongoid/safe.rb
mongoid-2.0.0.rc.2 lib/mongoid/safe.rb
mongoid-2.0.0.rc.1 lib/mongoid/safe.rb