Method: Mongoid::Relations::Bindings::Referenced::Many#bind_one

Defined in:
lib/mongoid/relations/bindings/referenced/many.rb

#bind_one(doc) ⇒ Object

Binds a single document with the inverse relation. Used specifically when appending to the proxy.

Examples:

Bind one document.

person.posts.bind_one(post)

Parameters:

  • doc (Document)

    The single document to bind.

Since:

  • 2.0.0.rc.1



19
20
21
22
23
# File 'lib/mongoid/relations/bindings/referenced/many.rb', line 19

def bind_one(doc)
  binding do
    bind_from_relational_parent(doc)
  end
end