Class: Ripple::Associations::OneKeyProxy

Inherits:
Proxy show all
Includes:
One
Defined in:
lib/ripple/associations/one_key_proxy.rb

Instance Attribute Summary

Attributes inherited from Proxy

#owner, #reflection, #target

Instance Method Summary collapse

Methods included from One

#to_a

Methods included from Instantiators

#build, #create, #create!

Methods inherited from Proxy

#===, #blank?, #has_changed_documents?, #initialize, #inspect, #loaded, #loaded?, #loaded_documents, #nil?, #present?, #proxy_respond_to?, #reload, #reset, #respond_to?, #send

Constructor Details

This class inherits a constructor from Ripple::Associations::Proxy

Dynamic Method Handling

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

Instance Method Details

#find_targetObject



19
20
21
# File 'lib/ripple/associations/one_key_proxy.rb', line 19

def find_target
  klass.find(owner.key)
end

#replace(doc) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/ripple/associations/one_key_proxy.rb', line 9

def replace(doc)
  @reflection.verify_type!(doc, owner)

  reset_previous_target_key_delegate
  assign_new_target_key_delegate(doc)

  loaded
  @target = doc
end