Module: Mongoid::Locking::Persistable::Creatable

Included in:
Mongoid::Locking::Persistable
Defined in:
lib/mongoid/locking/persistable/creatable.rb

Overview

:nodoc:

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#insert_as_embeddedObject

Raises:

  • (Errors::NoParent)

Since:

  • 0.1.0



5
6
7
8
9
10
11
12
13
14
# File 'lib/mongoid/locking/persistable/creatable.rb', line 5

def insert_as_embedded
  raise Errors::NoParent, self.class.name unless _parent

  if _parent.new_record?
    _parent.insert
  else
    selector = _parent.atomic_selector
    _update_one_locked(_root.collection, selector, positionally(selector, atomic_inserts))
  end
end