Class: Mongoid::Association::Embedded::EmbedsMany::Binding
- Inherits:
-
Object
- Object
- Mongoid::Association::Embedded::EmbedsMany::Binding
- Includes:
- Bindable
- Defined in:
- lib/mongoid/association/embedded/embeds_many/binding.rb
Overview
Binding class for all embeds_many associations.
Instance Attribute Summary
Attributes included from Bindable
#_association, #_base, #_target
Instance Method Summary collapse
-
#bind_one(doc) ⇒ Object
Binds a single document with the inverse association.
-
#unbind_one(doc) ⇒ Object
Unbind a single document.
Methods included from Bindable
Instance Method Details
#bind_one(doc) ⇒ Object
Binds a single document with the inverse association. Used specifically when appending to the proxy.
20 21 22 23 24 25 26 |
# File 'lib/mongoid/association/embedded/embeds_many/binding.rb', line 20 def bind_one(doc) doc.parentize(_base) binding do remove_associated(doc) try_method(doc, _association.inverse_setter(_target), _base) end end |
#unbind_one(doc) ⇒ Object
Unbind a single document.
34 35 36 37 38 |
# File 'lib/mongoid/association/embedded/embeds_many/binding.rb', line 34 def unbind_one(doc) binding do try_method(doc, _association.inverse_setter(_target), nil) end end |