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

Defined in:
build/mongoid-master/lib/mongoid/threaded/lifecycle.rb

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



161
162
163
164
165
166
# File 'build/mongoid-master/lib/mongoid/threaded/lifecycle.rb', line 161

def _creating
  Threaded.begin_execution(CREATE)
  yield
ensure
  Threaded.exit_execution(CREATE)
end