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 relations.
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 relation.
-
#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 relation. Used specifically when appending to the proxy.
21 22 23 24 25 26 |
# File 'lib/mongoid/association/embedded/embeds_many/binding.rb', line 21 def bind_one(doc) doc.parentize(_base) binding do doc.do_or_do_not(_association.inverse_setter(_target), _base) end end |
#unbind_one(doc) ⇒ Object
Unbind a single document.
36 37 38 39 40 |
# File 'lib/mongoid/association/embedded/embeds_many/binding.rb', line 36 def unbind_one(doc) binding do doc.do_or_do_not(_association.inverse_setter(_target), nil) end end |