Module: Mongoid::Threaded::Lifecycle::ClassMethods

Defined in:
lib/mongoid/threaded/lifecycle.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#_creatingObject

Execute a block in creating mode.

Examples:

Execute in creating mode.

creating do
  relation.push(doc)
end

Returns:

  • (Object)

    The return value of the block.

Since:

  • 2.1.0



171
172
173
174
175
176
177
# File 'lib/mongoid/threaded/lifecycle.rb', line 171

def _creating
  Threaded.begin(:create)
  yield
ensure
  Threaded.exit(:create)
  Threaded.clear_safety_options!
end

#_loading_revision?true, false

Is the current thread in loading revision mode?

Examples:

Is the current thread in loading revision mode?

proxy._loading_revision?

Returns:

  • (true, false)

    If the thread is loading a revision.

Since:

  • 2.3.4



187
188
189
# File 'lib/mongoid/threaded/lifecycle.rb', line 187

def _loading_revision?
  Threaded.executing?(:load_revision)
end