class Mongoid::Association::One
This is the superclass for one to one relations and defines the common behavior or those proxies.
Public Instance Methods
__evolve_object_id__()
click to toggle source
Evolve the proxy document into an object id.
@example Evolve the proxy document.
proxy.__evolve_object_id__
@return [ Object
] The proxy document’s id.
# File lib/mongoid/association/one.rb, line 49 def __evolve_object_id__ _target._id end
clear()
click to toggle source
Clear this relation - same as calling delete on the document.
@example Clear the relation.
relation.clear
@return [ true | false ] If the delete succeeded.
# File lib/mongoid/association/one.rb, line 17 def clear _target.delete end
in_memory()
click to toggle source
Get all the documents in the relation that are loaded into memory.
@example Get the in memory documents.
relation.in_memory
@return [ Array<Document> ] The documents in memory.
# File lib/mongoid/association/one.rb, line 27 def in_memory [ _target ] end
respond_to?(name, include_private = false)
click to toggle source
Since method_missing is overridden we should override this as well.
@example Does the proxy respond to the method?
relation.respond_to?(:name)
@param [ Symbol ] name The method name.
@return [ true | false ] If the proxy responds to the method.
Calls superclass method
# File lib/mongoid/association/one.rb, line 39 def respond_to?(name, include_private = false) _target.respond_to?(name, include_private) || super end