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
# File 'lib/mongoid/threaded/lifecycle.rb', line 171

def _creating
  Threaded.begin_create
  yield
ensure
  Threaded.exit_create
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



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

def _loading_revision?
  Threaded.loading_revision?
end