Class: MassiveRecord::ORM::Relations::Proxy::ReferencesOne

Inherits:
MassiveRecord::ORM::Relations::Proxy show all
Defined in:
lib/massive_record/orm/relations/proxy/references_one.rb

Overview

Proxy used to reference one other object in another table.

Instance Attribute Summary

Attributes inherited from MassiveRecord::ORM::Relations::Proxy

#metadata, #proxy_owner, #proxy_target

Instance Method Summary collapse

Methods inherited from MassiveRecord::ORM::Relations::Proxy

#blank?, #initialize, #inspect, #is_a?, #load_proxy_target, #loaded!, #loaded?, #method_missing, #reload, #reset, #respond_to?, #to_param

Constructor Details

This class inherits a constructor from MassiveRecord::ORM::Relations::Proxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MassiveRecord::ORM::Relations::Proxy

Instance Method Details

#proxy_target=(proxy_target) ⇒ Object



10
11
12
13
# File 'lib/massive_record/orm/relations/proxy/references_one.rb', line 10

def proxy_target=(proxy_target)
  set_foreign_key_in_proxy_owner(proxy_target.id) if proxy_target
  super(proxy_target)
end

#replace(proxy_target) ⇒ Object



15
16
17
18
# File 'lib/massive_record/orm/relations/proxy/references_one.rb', line 15

def replace(proxy_target)
  super
  set_foreign_key_in_proxy_owner(nil) if proxy_target.nil?
end