class Mongoid::Association::Referenced::HasMany::Binding

Binding class for has_many associations.

Public Instance Methods

bind_one(doc) click to toggle source

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

@example Bind one document.

person.posts.bind_one(post)
# File lib/mongoid/association/referenced/has_many/binding.rb, line 18
def bind_one(doc)
  binding do
    bind_from_relational_parent(doc)
  end
end
unbind_one(doc) click to toggle source

Unbind a single document.

@example Unbind the document.

person.posts.unbind_one(document)
# File lib/mongoid/association/referenced/has_many/binding.rb, line 28
def unbind_one(doc)
  binding do
    unbind_from_relational_parent(doc)
  end
end