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

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) _creating

Execute a block in creating mode.

Examples:

Execute in creating mode.

creating do
  relation.push(doc)
end

Since:

  • 2.1.0



154
155
156
157
158
159
# File 'lib/mongoid/threaded/lifecycle.rb', line 154

def _creating
  Threaded.begin_execution("create")
  yield
ensure
  Threaded.exit_execution("create")
end