Class: Mongoid::Association::One
- Defined in:
- lib/mongoid/association/one.rb
Overview
This is the superclass for one to one relations and defines the common behavior or those proxies.
Direct Known Subclasses
Embedded::EmbeddedIn::Proxy, Embedded::EmbedsOne::Proxy, Referenced::BelongsTo::Proxy, Referenced::HasOne::Proxy
Instance Attribute Summary
Attributes inherited from Proxy
#_association, #_base, #_target
Instance Method Summary collapse
-
#__evolve_object_id__ ⇒ Object
Evolve the proxy document into an object id.
-
#clear ⇒ true, false
Clear this relation - same as calling #delete on the document.
-
#in_memory ⇒ Array<Document>
Get all the documents in the relation that are loaded into memory.
-
#respond_to?(name, include_private = false) ⇒ true, false
Since method_missing is overridden we should override this as well.
Methods inherited from Proxy
apply_ordering, #extend_proxies, #init, #klass, #reset_unloaded, #substitutable
Methods included from Marshalable
Instance Method Details
#__evolve_object_id__ ⇒ Object
Evolve the proxy document into an object id.
48 49 50 |
# File 'lib/mongoid/association/one.rb', line 48 def __evolve_object_id__ _target._id end |
#clear ⇒ true, false
Clear this relation - same as calling #delete on the document.
16 17 18 |
# File 'lib/mongoid/association/one.rb', line 16 def clear _target.delete end |
#in_memory ⇒ Array<Document>
Get all the documents in the relation that are loaded into memory.
26 27 28 |
# File 'lib/mongoid/association/one.rb', line 26 def in_memory [ _target ] end |
#respond_to?(name, include_private = false) ⇒ true, false
Since method_missing is overridden we should override this as well.
38 39 40 |
# File 'lib/mongoid/association/one.rb', line 38 def respond_to?(name, include_private = false) _target.respond_to?(name, include_private) || super end |