Class: ActiveMongoid::Associations::One

Inherits:
Proxy
  • Object
show all
Defined in:
lib/active_mongoid/associations/one.rb

Instance Attribute Summary

Attributes inherited from Proxy

#__metadata__, #base, #target

Instance Method Summary collapse

Methods inherited from Proxy

#init, #klass, #method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveMongoid::Associations::Proxy

Instance Method Details

#==(other) ⇒ Object



13
14
15
16
17
18
# File 'lib/active_mongoid/associations/one.rb', line 13

def ==(other)
  return false unless other
  return true if target.object_id == other.object_id
  return true if target.attributes == other.attributes
  target == other
end

#clearObject



5
6
7
# File 'lib/active_mongoid/associations/one.rb', line 5

def clear
  target.delete
end

#respond_to?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/active_mongoid/associations/one.rb', line 9

def respond_to?(name, include_private = false)
  target.respond_to?(name, include_private) || super
end