Class: Mongoid::Association::Embedded::EmbedsMany::Binding
- Inherits:
-
Object
- Object
- Mongoid::Association::Embedded::EmbedsMany::Binding
- Includes:
- Bindable
- Defined in:
- build/mongoid-8.1/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.
19 20 21 22 23 24 25 |
# File 'build/mongoid-8.1/lib/mongoid/association/embedded/embeds_many/binding.rb', line 19 def bind_one(doc) doc.parentize(_base) binding do remove_associated(doc) doc.do_or_do_not(_association.inverse_setter(_target), _base) end end |
#unbind_one(doc) ⇒ Object
Unbind a single document.
33 34 35 36 37 |
# File 'build/mongoid-8.1/lib/mongoid/association/embedded/embeds_many/binding.rb', line 33 def unbind_one(doc) binding do doc.do_or_do_not(_association.inverse_setter(_target), nil) end end |